On Thu, 2003-09-25 at 12:40, Jay Kline wrote:
> On Thu, 25 Sep 2003 12:15:38 -0500
> "Lansing, Dan" <Dan.Lansing at AndersenCorp.com> wrote:
> >I have written a small ugly script to restart some services which
> >occasionally quit for unknown reasons...is there a way I can write a script
> >to check if the services are running and run my restart script if they die?
> 
> There are a lot of different ways to handle this.  The way I handle it for
> one of my servers, is every 15 min a script is run from cron, and uses pidof
> to determine if there are any processes running with that name. If the
> process writes its pid to a file, just check to see if that pid is running
> (though this can fail- its possible for the process to quit, and a new,
> unrelated process to get its pid).  

Alternately, you can use the Big Brother (http://bb4.com/) style
approach, rather than just checking if the process exists, write a test
that actually connects to the service and see if it gets a response. For
example for a web server, use something like wget to grab a page, if it
fails, nuke the service and restart it. This will cover you in the event
of a wedged yet still running process.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://shadowknight.real-time.com/pipermail/tclug-list/attachments/20030926/6eeed26c/attachment.pgp