This is a fairly common approach in Unix environments. A file is saved under the /var/run/ directory with the contents being the PID of the process that started it. Deamons check for the file common to itself and die if they see the file there (though it sounds like you want to sleep instead).
----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
Note: All code is untested, unless otherwise stated
In reply to Re: Ensuring only one copy of a program is running
by hardburn
in thread Ensuring only one copy of a program is running
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |