|
It maybe a bit of a workaround, but could you make your program create a certain file as soon as it starts in /tmp or /var/run. And check before if the file exists, and if it does exit (as not to start another instance).
A good way to do this, is to open the file from the start of the program and not closing it anywhere. Instead delete (unlink) it immediately after opening.
The file will then be deleted when the program exits, or when it's killed. This way the file will also be deleted if the program is killed some day. And also it wouldn't matter is another program tries to delete it, while your program is running.
Last edited by Hko; 11-28-2002 at 05:21 PM.
|