monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [monit] Check if a process is running


From: Eric Pailleau
Subject: Re: [monit] Check if a process is running
Date: Mon, 25 May 2009 09:35:25 +0200
User-agent: Thunderbird 2.0.0.21 (X11/20090330)

mercadodei mercado a écrit :
Hello All
To check if a process is running the only thing I have to do is :
check process <process> with pidfile "/var/run/<process>.pid"
  start = "/etc/init.d/<process> start"
  stop = "/etc/init.d/<process> stop"
right ?
and if the process doesn't have pid file (I know that this question is already answered but I would like to know your opinions)
Thanks


------------------------------------------------------------------------

--
To unsubscribe:
http://lists.nongnu.org/mailman/listinfo/monit-general

In addition to my May 23rd 's mail,
you can also look at FAQ in Monit Wiki.

A solution with a wrapper script is given, but be aware
that in pidfile is the PID of the wrapper script : if your program crashe (and 
not the wrapper),
monit will still see a living PID and do nothing.
My solution use real PID of your program.

Another hint :

the 'ps' command I gave you give ALL PID of a program :
if your program forks with several children you may rather
use father PID. In such case replace :

ps -C nopidfilebinaray -o pid= | tr -d ' '

by

ps -C nopidfilebinaray -o pid= | head -1 | tr -d ' '

regards




reply via email to

[Prev in Thread] Current Thread [Next in Thread]