The stupid question is the question not asked | |
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?? |
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.
In Section
Seekers of Perl Wisdom
|
|