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

Re: Ensure Only One Instance of Your Script is Running... with 'ps -ef' ?

by LanX (Saint)
on Dec 05, 2022 at 22:21 UTC ( [id://11148584]=note: print w/replies, xml ) Need Help??


in reply to Ensure Only One Instance of Your Script is Running... with 'ps -ef' ?

I think you are applying flock in a wrong way, which offers race conditions.

The lock must happen in one atomic step and only the script having the lock must be allowed to write. Not the script which created the locked file.

Did you try the code I offered?

Cheers Rolf
(addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
Wikisyntax for the Monastery

Edit

Improved wording

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-03-29 02:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found