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

Re: Ensuring only one copy of a perl script is running at a time

by sgt (Deacon)
on Dec 19, 2006 at 21:53 UTC ( [id://590803]=note: print w/replies, xml ) Need Help??


in reply to Ensuring only one copy of a perl script is running at a time

I have often used the algorithm described in LockFile::Simple by Rafael Manfredi which uses atomic operations of the file system. Not perfect but simple enough that it can be also implemented in pure shell (no external commands) which can be useful sometimes. It can even (mostly) work over NFS/NAS supposing a not-too-dumb NFS implementation.

The windows behavior is certainly confusing. what is the point of having a supposatly portable implementation of locking (perl's flock) if you cannot use it on some platform; I would rather have it die saying not implemented so that one knows a work-around is needed. I think it's a bug (at least a documentation bug)

hth --stephan
  • Comment on Re: Ensuring only one copy of a perl script is running at a time

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2024-04-25 15:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found