[Chicago-talk] pid files and whatchamacalits.

Jim Thomason jthomasoniii at yahoo.com
Tue Dec 9 16:56:55 CST 2003


If you're guaranteed that the script has a unique
name, you could always just do a ps (however you
prefer) and check to see if it's running in there.

Still not exactly pretty, but it saves you the temp
file.

-Jim....

--- "Dooley, Michael" <Dooley.Michael at con-way.com>
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


__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/



More information about the Chicago-talk mailing list