Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Checking for multiple instances

by radiantmatrix (Parson)
on Sep 24, 2004 at 18:08 UTC ( [id://393619]=note: print w/replies, xml ) Need Help??


in reply to Checking for multiple instances

Depending on your specific requirements, use one of
  • Proc::PID_File - takes care of PID file use for you.
  • Proc::PID::File - OO way to do the above
  • Linux::PID - for managing multi-threaded applications' PPID's on Linux (you still have to deal with files yourself).
CPAN is a wonderful thing, yes? There are also a number of pid server daemons that can track these types of things well, and Perl modules to talk to them. Or, you can solve the problem in your cron script with the insanely simple:
#!/bin/bash if (ps ax |grep -q "my_perl_script_name") ; then exit; fi my_perl_script_name
require General::Disclaimer;

All code, unless otherwise noted, is untested

"All it will give you though, are headaches after headaches as it misinterprets your instructions in the most innovative yet useless ways." - Maypole and I - Tales from the Frontier of a Relationship (by Corion)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://393619]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2024-04-25 12:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found