0.0.115 • Published 6 years ago

quicklock v0.0.115

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

QuickLock


install: $ curl -o- https://raw.githubusercontent.com/oresoftware/quicklock/master/install.sh | bash

or

install: $ wget -q -O - https://raw.githubusercontent.com/oresoftware/quicklock/master/install.sh | bash

Simple usage

#!/usr/bin/env bash

# acquire lock. will exit with exit code 1, if lock cannot be acquired the first time
# first and only argument is an optional lockname, if no argument is passed, $PWD will be used as a good default.

ql_acquire_lock "$PWD"  

# your critical code goes here

foobarbaz --watch   # this can be whatever you want

# when the script/process exits, lock will automatically be released

Explicit unlocking

For most use cases you don't need to explicitly unlock.

#!/usr/bin/env bash

ql_acquire_lock "$PWD" 

# your critical code goes here
echo "foo bar bar"

# we can release the lock here if we want and continue with more commands 

ql_release_lock <lockname>  # lockname is an optional argument

# we released the lock, because we are done with the critical section
# now we can run whatever

dosomethingelse here

Debugging

To get a list of all the quicklock locks that exist, use:

$ ql_ls

To determine which process holds a lock, use:

$ ql_find <lockname> # lockname is optional

ql_find echos a pid, if the lock exists. To find out information about that pid, you can use:

$ ps -p <pid>

or just do this:

$ ql_find | xargs ps -p


Colors

Terminal colors/styling is on by default.

To turn off color use:

$ ql_no_color

to turn colors back on, use:

$ ql_add_color

0.0.115

6 years ago

0.0.114

6 years ago

0.0.113

6 years ago

0.0.112

6 years ago

0.0.111

6 years ago

0.0.109

6 years ago

0.0.108

6 years ago

0.0.107

6 years ago

0.0.106

6 years ago

0.0.105

6 years ago

0.0.104

6 years ago

0.0.103

6 years ago

0.0.101

6 years ago