[suse-mirror] ANN: withlock - reliable & easy locking for cron jobs
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 when you receive this mail more than once, due to crossposting to some forums where to reach most people-- To unsubscribe, e-mail: mirror+unsubscribe@opensuse.org For additional commands, e-mail: mirror+help@opensuse.org
On 22/02/10 12:47 PM, "Peter Pöml" <poeml@cmdline.net> wrote:
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 :-)
We've been using it for a month or two on our various mirror scripts, and are starting to use it elsewhere as well. It makes things much tidier - we went from having complex scripts checking lock files before running rsync on everything that we mirrored to having one line in cron for each. It saves us a lot of headaches - so thank you :-) -Shaun -- To unsubscribe, e-mail: mirror+unsubscribe@opensuse.org For additional commands, e-mail: mirror+help@opensuse.org
participants (2)
-
Peter Pöml
-
Shaun Ewing