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' ?