On Tuesday, Nov 19, 2002, at 05:21 US/Pacific, zentara wrote:
[..]
This method actually scans ps for the process name, but there
are other methods possible, like finding apache's pid and storing
it to a file, then checking for the existence of the pid, instead of the
name.
[..]

Normally one should put down a 'pidFile' with the Process ID
of the 'daemonized' process - like your monitoring script there.

If you had a standard pidFile - you can do some 'locking' -

if ( -f $pidFile ) {
# if we are starting up - we have a possible live process out there
# therefore we should either pre-empt and take over, killing the existing
# one and putting our PID into it....
pidFileExists('pre-empt');
}

The usual problem of course is that someone 'cleared out /tmp'
and hence removed the $pidFile out there... this is when you
want to grovel the Proc::ProcessTable for the cmdline argument.

But when it comes time to Kill ourselves off, then one simply
open's one's PID file and kills the running version..

ciao
drieux

---

http://www.wetware.com/drieux/pbl/Sys/daemon1.txt


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to