Hello,
Is there a generic built-in way on CentOS to overlook that a specific process is alive and re-spawn it (or just run a configured command) when it dies?
I know how to script things so a parent will watch its child, but was wondering whether there is something more readily available instead of having to reinvent the wheel.
The process must be controlled via a /etc/init.d/... script and should be stop-able (it runs in a primary/stand-by configuration), so use of "respawn" in inittab is not a solution.
So far googl'ing for "watchdog" comes up with references about system watchdog - which will reboot the system if the kernel appears to be stuck.
Thanks,
--Amos
Amos Shapira wrote:
Is there a generic built-in way on CentOS to overlook that a specific process is alive and re-spawn it (or just run a configured command) when it dies?
Monit
works well for me in a very diverse set of jobs and roles.
2008/12/11 Karanbir Singh kbsingh@centos.org:
Amos Shapira wrote:
Is there a generic built-in way on CentOS to overlook that a specific process is alive and re-spawn it (or just run a configured command) when it dies?
Monit
works well for me in a very diverse set of jobs and roles.
Thanks! Obvious answer.
I can't understand why I was stuck on looking for "watchdog" and not "monitor". I'll try to use monit for everything else on my system too.
Cheers,
--Amos
Amos Shapira wrote:
Hello,
Is there a generic built-in way on CentOS to overlook that a specific process is alive and re-spawn it (or just run a configured command) when it dies?
I know how to script things so a parent will watch its child, but was wondering whether there is something more readily available instead of having to reinvent the wheel.
The process must be controlled via a /etc/init.d/... script and should be stop-able (it runs in a primary/stand-by configuration), so use of "respawn" in inittab is not a solution.
So far googl'ing for "watchdog" comes up with references about system watchdog - which will reboot the system if the kernel appears to be stuck.
Thanks,
--Amos
You might take a glance at daemontools:
http://cr.yp.to/daemontools/faq.html
The directory layout is a bit nonstandard, but it does what you're looking for. I believe SME Server (which is built on top of CentOS) makes use of this tool set...
-Greg
Can't you just add an entry to /etc/inittab?
This worked well for me
On Thu, Dec 11, 2008 at 5:52 AM, Greg Bailey gbailey@lxpro.com wrote:
Is there a generic built-in way on CentOS to overlook that a specific process is alive and re-spawn it (or just run a configured command) when it dies?
On Thu, 2008-12-11 at 21:48 +0100, Alexander Farber wrote:
Can't you just add an entry to /etc/inittab?
This worked well for me
On Thu, Dec 11, 2008 at 5:52 AM, Greg Bailey gbailey@lxpro.com wrote:
Is there a generic built-in way on CentOS to overlook that a specific process is alive and re-spawn it (or just run a configured command) when it dies?
He wants to be able to kill it and not have it respawn. That throws a little glitch into the process.
If it were me (and no package was suitable), a little bash script that starts it off in a while loop, waits on the child, checks a switch (maybe in a file created by another little bash script that he invokes when desired) that says "STOP" or some-such. If the switch doesn't say that, starts the process again. If it says stop, exits and maybe leaves a message or sends mail that a stop was requested.
All told, about 20 lines of script or so.
But reading the bash man page, if you're not already familiar with bash, may be a PITA.
IIRC, some others have suggested some packages already that will do what the OP wants.
<snip sig stuff>