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 reply to Re: Mechanism for ensuring only one instance of a Perl script can only run?
by ikegami
in thread Mechanism for ensuring only one instance of a Perl script can only run?
by redapplesonly
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |