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

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

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 cooling their heels in the Monastery: (9)
As of 2024-07-24 11:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.