[Chicago-talk] pid files and whatchamacalits.

Ed Summers ehs at pobox.com
Tue Dec 9 17:12:25 CST 2003

On Tue, Dec 09, 2003 at 02:50:23PM -0800, Dooley, Michael wrote:
> outside of checking for a pid file does anyone have any cleaner ways of
> checking to see if the script is already running?

This isn't solving the problem with Perl, but when you install Bernstein's
daemontools package [1] you get a handy little program called setlock [2].
setlock is useful in cron scripts since all you have to do is:

    * * * * * setlock -n /tmp/progname.lock progname.pl

Where /tmp/progname.lock is the name of the lock file you want to use. The
-n says don't bother waiting for the lock to be released.


[1] http://cr.yp.to/daemontools.html
[2] http://cr.yp.to/daemontools/setlock.html

More information about the Chicago-talk mailing list