Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Mechanism for ensuring only one instance of a Perl script can only run?

by ikegami (Patriarch)
on Dec 03, 2022 at 05:51 UTC ( [id://11148519]=note: print w/replies, xml ) Need Help??


in reply to Mechanism for ensuring only one instance of a Perl script can only run?

Two comments:

Your solution suffers from a race condition, and could allow two instances of the script to run at the same time.

A couple of people mentioned using a non-blocking flock. That's a great simple solution, but it comes with a major caveat: It's doesn't work or it's unreliable on some file systems (notably NFS). Also, I don't know if it'll work on Windows.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-03-28 13:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found