Categories
Posts

Solo

Solo is an interesting little Perl script:

solo is a very simple script (10 lines) that prevents a program from running more than one copy at a time. It is useful with cron to make sure that a job doesn’t run before a previous one has finished.

* * * * * solo -port=3801 /usr/local/bin/awesome-script.sh blah blah

The clever part is the use of binding to TCP ports to ensure that only one copy of the script is running at a time. No more lockfiles or filesystem tricks, just let the kernel figure out if the port is already in use.

4 replies on “Solo”

Hi,

I would suggest to release and PHP implementation of this tiny tool.

I feel this necessary because for example when you want to implement such “locking” in jailed environment where only PHP is available you won’t be able to do it as perl is missing.

Thanks!

The source for the Perl script is linked in the post. Porting it to other languages shouldn’t be too bad if you don’t have the option of having Perl available.

Leave a Reply

Your email address will not be published. Required fields are marked *