lockrun - overrun protection for cron jobs
Jun 23rd, 2006 by Phil Dawes
Found this really handy yesterday. It’s a c binary that wraps your script and checks a lockfile before running it.
e.g. to run ‘myscript’ if it’s not currently running:
lockrun --lockfile=/tmp/mylockfile -- myscript
The cool thing is that it uses flock to implement the lockfile, so the lock is automatically free’d when the process dies. (hence the reason for being a C binary rather than a shell script).
Lockrun is ultra handy if you need to run a command every minute, but don’t want them backing up if something causes one to take longer than a minute.
Also I guess you could use it to keep processes up - i.e. lockrun exits if the process is already running, but if not it starts a new one.

Add New Comment
Viewing 2 Comments
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Add New Comment