The software on this pages will slowly be moved to GitHub https://github.com/hilbix/. The CVS repository will be migrated to GIT as well, so the history will be preserved, a bit. See FAQ.
The tools are developed under Linux with
release early, release often
So you can consider this beta software, or alpha, or pre-alpha, or even worse ;)
Have a look in the download directory for all downloads.
As always here, all you get is the source. No binaries here.
Exclusively run something by placing a file lock
⇒ ⇒ ⇒ The development shifted to another location. All future versions will be published at https://github.com/hilbix/lockrun ⇐ ⇐ ⇐
There is a similar Debian package "lckdo" which has some different features.
Lockrun opens or creates a file, places a lock on the file, and if obtained, runs some other program. If the program terminates, the lock is removed.
If there already is a lock on the file, it waits for the lock to be aquired. With option -n it does not wait for the lock and instead returns false or true in case option -i is used.
With option -u a lockfile can be created which is safely removed after it is no more needed (this option is experimental). To safely remove such a locked file after crashes you can use 'lockrun -vvu "file" true'.
Option -q now disables timeout message if lock cannot be aquired.
Option -m added. Option -v can be given twice. Minor cosmetic changes like usage pattern corrected for "Invoke shell script only once".
Note that you would want to lock for the shell script's name (like presented in the usage) and not for some MAGIC. Also note that locking a shell script often does not work, as some shells do not like to run locked files.
Option -v now can be more verbose (only in combination with option -u). Option -m changes the return code in case the error comes from lockrun and not the forked child.
Option -i makes lockrun return success even if the lock could not aquired and the cmd was not run.
Use this if you desparately need the return value of your cmd and not being able to aquire a lock is no failure (i. e. because something else is processing). Please note lockrun still returns a non-success value for other type of errors (like disk write error).
For example "lockrun -ni .lock false" now returns 0 (success) if lock cannot be aquired and 1 (false) if the file was lockable. So it now is (vastly) the opposite of "lockrun -n .lock true". Both will fail if, for example, the current directory is not writeable. (Note that the lock is only held while the command runs.)
Option -f added
If this option is present, this makes lockrun fail if the given file to lock is missing.
Option -c, -d and -l added.
With option -l you can redirect logging to some other fd, like in "lockrun -vl42 cmd 42>file".
With options -c and -d you can display a "waiting string" to stdout. If you need it to stderr, try -l2.
|[view more history]||[view complete history]|
License and Disclaimer
All you can see here is free software according to the GNU GPL.