Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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.

  • Comment on Re: Mechanism for ensuring only one instance of a Perl script can only run?
  • Download Code

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 avoiding work at the Monastery: (1)
As of 2024-04-15 11:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found