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

Re^3: Proc::PID::File problem generating pid files, or: does it matter where a pid file lives?

by JavaFan (Canon)
on May 31, 2010 at 09:06 UTC ( #842372=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Proc::PID::File problem generating pid files, or: does it matter where a pid file lives?
in thread Proc::PID::File problem generating pid files, or: does it matter where a pid file lives?

The PID file also serves another purpose: it allows external resources to communicate with the service in a specified manner.
I would say, that's the only reason to use PID files. There's no need to use PID files to prevent simultaneous access to resources; for that, lock files are enough. And if all you care about is preventing concurrent running of the same program (which is what the OP needs), all you need to do is obtain a lock on yourself (no external files needed):
flock DATA, LOCK_EX or die "Another instance is already running";


Comment on Re^3: Proc::PID::File problem generating pid files, or: does it matter where a pid file lives?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (17)
As of 2015-07-02 17:36 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 (44 votes), past polls