Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Check for another running instance of the same program

by dd-b (Monk)
on May 13, 2013 at 22:34 UTC ( #1033373=note: print w/ replies, xml ) Need Help??


in reply to Check for another running instance of the same program

You can safely automate the deletion of the semaphore file by writing the PID to it, and having later programs check if the PID exists as a running process; if not it can delete the file and proceed.

Consider your requirements carefully; for example, does it apply to one system, or all systems that can access a particular NFS mount, or all systems on a built-in list with IP connectivity, or what exactly. These lead to very different solutions. Do you want to consider expanding it to "no more than n" copies running at once, or is the simple one at a time good?


Comment on Re: Check for another running instance of the same program

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (9)
As of 2015-07-07 19:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls