Summary: Watchdog Script

From: Andreas Hoeschler <>
Date: Mon Sep 08 2003 - 10:02:49 EDT
Dear managers,

thanks for the overwhelming response.

"Mike Demarco" <>
Reggie Beavers < >
"Simon Phillips" <>
"Skip Hammack" <>
"Gurugunti, Mahesh" <>

The easiest solution was suggested by Tony Schloss and looks as follows:

> #!/bin/sh
> if [ ! `/usr/bin/pgrep OurService` ] ; then
>         nohup ./OurService &
> fi
> exit 0

Others suggested to use inittab or respawn (see man pages). I will try 
that as well. However, since in the general case I need to path 
parameters  the avove script/crontab seems the best.

Thanks a lot,


The questions was as follows

Dear managers,

we have a service process running in the background that unfortunately 
dies from time to time. We are researching why. However, until we have 
found the bug we would like to setup a script that is called by cron 
every 5 mins. This script should check whether the process is still 
running with something like

ps -Af | grep OurService

and if it is not then restart it with

nohup ./OurService &

I have no idea how such a shell script would look like. Ideas are 
greatly appreciated.

Thanks ins advance!


sunmanagers mailing list
Received on Mon Sep 8 10:06:52 2003

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:19 EST