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

Re: making a process "watch dog" - shell or Perl?



On Wed, Jan 09, 2002 at 10:34:50AM -0800, Robert Threet wrote:
> What's everybody use to monitor a process and restart it if
> it dies?  I was going to write something but I figured
> someone out there already did.  

Here's one I wrote to clean up after a dead named and restart it:

    http://www.silug.org/~steve/software/scripts/perl/namedmon

The script could be modified for any other process pretty trivially.

If the process can be made to not fork itself into the background, the
job is even easier.  You can just run it with this:

    #!/bin/sh
    while :; do
        $program $options
    done

(Wrap that whole thing in "( ) &" to run it in the background.)  Or
you can add the process to /etc/inittab and let init respawn it for
you.

Steve
-- 
steve@silug.org           | Southern Illinois Linux Users Group
(618)398-7360             | See web site for meeting details.
Steven Pritchard          | http://www.silug.org/

-
To unsubscribe, send email to majordomo@luci.org with
"unsubscribe luci-discuss" in the body.