auto restarting a daemon process with RHEL's init system

2009-06-30 Thread Michael Torrie
Is there any utility program that can wrap a daemon running in an init
script on RHEL 5 that can auto-restart the actual daemon process when it
crashes?  Obviously a crashing daemon isn't desirable, but sometimes it
happens and in this case a restart is sufficient and desired.  I'd like
to still work with a script from /etc/init.d, though, so the standard
runtime logic can apply to it.  Does anyone have a good solution?  I
thought about writing a little python program to fork the daemon child
(gotta love it!) and monitor it for SIGTERM or SIGKILL and restart it.
The init.d script could treat the python program as the daemon itself.
If the python script got a kill signal it would pass it on to the child
and then exit.  The changes of the python program dying are much smaller
than the daemon I'm trying to respawn.

Are there any existing solutions?  A cron watchdog seems a little crude
to me (and has no knowledge of runlevels)  I also know how to use
/etc/inittab, but that seems a little crude (and harder to maintain).

I used to think Apple's launchd was a convoluted non-necessity compared
to the familiar system V init system.  But now I find myself in a
position where it would be just what I need.

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/


Re: auto restarting a daemon process with RHEL's init system

2009-06-30 Thread Byron Clark
On Tue, Jun 30, 2009 at 02:00:50PM -0600, Michael Torrie wrote:
 Are there any existing solutions?  A cron watchdog seems a little crude
 to me (and has no knowledge of runlevels)  I also know how to use
 /etc/inittab, but that seems a little crude (and harder to maintain).

Not included in RHEL5, but daemon[1] should work well.

[1] http://libslack.org/daemon/

-- 
Byron Clark


/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/


Re: auto restarting a daemon process with RHEL's init system

2009-06-30 Thread Matthew Walker

I like daemontools for this. It would be possible to set it up to start/stop a
daemontools managed process with initscripts too.

-- 
Matthew Walker
Kydance Hosting  Consulting, Inc. - http://www.kydance.net/
PHP, Perl, and Web Development - Linux Server Administration

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/


Re: auto restarting a daemon process with RHEL's init system

2009-06-30 Thread Shane Hathaway
Michael Torrie wrote:
 Is there any utility program that can wrap a daemon running in an init
 script on RHEL 5 that can auto-restart the actual daemon process when it
 crashes?  Obviously a crashing daemon isn't desirable, but sometimes it
 happens and in this case a restart is sufficient and desired.  I'd like
 to still work with a script from /etc/init.d, though, so the standard
 runtime logic can apply to it.  Does anyone have a good solution?  I
 thought about writing a little python program to fork the daemon child
 (gotta love it!) and monitor it for SIGTERM or SIGKILL and restart it.
 The init.d script could treat the python program as the daemon itself.
 If the python script got a kill signal it would pass it on to the child
 and then exit.  The changes of the python program dying are much smaller
 than the daemon I'm trying to respawn.

Supervisor.

http://supervisord.org/

I like it, but not just because it's Python. ;-)  It really has all the 
features listed on the home page.

Shane


/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/


Re: auto restarting a daemon process with RHEL's init system

2009-06-30 Thread Michael Torrie
Shane Hathaway wrote:
 Supervisor.
 
 http://supervisord.org/
 
 I like it, but not just because it's Python. ;-)  It really has all the 
 features listed on the home page.

Looks about like what I want. thanks!  Plug is better than google today!

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/


Re: auto restarting a daemon process with RHEL's init system

2009-06-30 Thread Gabriel Gunderson
On Tue, Jun 30, 2009 at 3:08 PM, Michael Torrietorr...@gmail.com wrote:
 Looks about like what I want. thanks!  Plug is better than google today!

If you like that, you should totally try Bing!

Gabe

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/