[Chicago-talk] pid files and whatchamacalits.

Mike Pastore mike at oobak.org
Tue Dec 9 17:52:19 CST 2003


Whenever I run into something like this, I like to check and see how
some other Perl program or module does it. For example, CPAN.pm examines
the contents of a pidfile, much like what you're doing. (Search for "sub
checklock" to see exactly how.) 

--
Mike Pastore
mike at oobak.org

On Tue, 2003-12-09 at 16:50, Dooley, Michael wrote:
> I have a perl script that runs via cron.
> 
> outside of checking for a pid file does anyone have any cleaner ways of
> checking to see if the script is already running?
> 
> I was looking at Proc::PID_File. but I would like to try and stay with the
> default install of perl.
> This is perl, v5.8.0 built for sun4-solaris
> 
> Is below a standard way to do this?
> 
> if (-e "/tmp/pid.file") {
> exit;
> } else {
> open (PID, ">/tmp/pid.file");
> print PID $$;
> close PID;
> }
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at mail.pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk




More information about the Chicago-talk mailing list