laziness, impatience, and hubris | |
PerlMonks |
Re: Make a perl script self aware...by sgifford (Prior) |
on Aug 01, 2003 at 18:06 UTC ( [id://280072]=note: print w/replies, xml ) | Need Help?? |
The device you're looking for is called a mutex. In UNIX, you can use locks for this. Create a lock file, lock it with fcntl. If somebody's already holding the lock (your nonblocking request for a lock is denied), somebody else is already running; if it works, you're in the clear. If the process dies or exits, the OS will automatically remove the lock. Surely Windows has a lock that works like this, or some other form of mutex.
In Section
Seekers of Perl Wisdom
|
|