[mirror discuss] ANN: withlock - reliable & easy locking for cron jobs

From: Peter Pöml <poeml_at_cmdline.net>
Date: Mon, 22 Feb 2010 02:51:16 +0100
Hi,

this is a one-time post to announce the creation of "withlock" - a locking wrapper script to make sure that some program isn't run more than once. It is ideal to prevent periodic jobs spawned by cron from stacking up. The locks created are valid only while the wrapper is running, and thus will *never* require additional cleanup, even after a reboot. This makes the wrapper safe and easy to use, and much better than implementing half-hearted locking within scripts.

Usage is simple. Instead of your command
 CMD ARGS...

you simply use
 withlock LOCKFILE CMD ARGS...


If you are a mirror admin, there is a 99.9% chance that you might want to use this locking wrapper. Likely you ran into the situation where a script was (unexpectedly...) not finished before it was started another time; and/or you actually hacked some kind of locking into a script to prevent that from happening.

Since I suffered the same situation for some years, I looked around for solutions, and since I couldn't find one, I finally took the time to create one. The resulting wrapper is used in production since summer 2009, and proved to work reliably. Put the wrapper around all your cron jobs and be happy :-)


Home page: http://code.google.com/p/withlock/

Features:
 - locks that never need a cleanup, whatever might happens
 - can wait a defined time for a lock to become "free"
 - makes sure that lock files aren't created in unsafe locations (to prevent symlink attacks)
 - easily installed (it's just one file), highly portable

Requirements:
 - Python 2.4 or newer
 - lots of platforms are supported (see list on home page)

For more information, please come to http://code.google.com/p/withlock/ .

Thanks,
Peter

PS. Apologies to those of you who received this mail more than once, due to crossposting to some different forums in order to reach most people
_______________________________________________
discuss mailing list
Archive: http://mirrorbrain.org/archive/discuss/

Note: To remove yourself from this mailing list, send a mail with the content
 	unsubscribe
to the address discuss-request_at_mirrorbrain.org
Received on Mon Feb 22 2010 - 01:51:30 GMT

This archive was generated by hypermail 2.3.0 : Wed May 05 2010 - 19:47:04 GMT