The stupid question is the question not asked | |
PerlMonks |
Detecting stale pid file under *nixby Dallaylaen (Chaplain) |
on Oct 24, 2016 at 21:36 UTC ( [id://1174627]=perlquestion: print w/replies, xml ) | Need Help?? |
Dallaylaen has asked for the wisdom of the Perl Monks concerning the following question: This is more of a Unix question rather than a Perl one, but still... I'm looking for a way to stop my daemon, but I don't want to terminate an innocent bystander process. I came up with idea that PID file is created after the process has been spawned. Therefore, it's not older then the process, so the following code was written which seems to work correctly on my Ubuntu:
Of course, it can still be tricked by touching the pid file, but then it's also possible to write rubbish into the pid file anyway. Now I would like to ask what is the proper way of avoiding sending signal to a wrong process? CPAN has a multitude of modules for PID file handling, I was unable to choose one. Thank you!
Back to
Seekers of Perl Wisdom
|
|