"watchdog" for a process?

Brian Fahrlander brian at fahrlander.net
Wed Sep 19 21:17:44 UTC 2007


Bart Silverstrim wrote:
> Is there a quick and short script, maybe something that can be run in 
> Cron, that will look at the process list and if a process has been 
> killed or had died will restart the process?

     That's what /etc/inittab does.  I'm using it for both side of my 
sensor/controller project:

dd:2345:respawn:/usr/local/bin/displayd 2>/dev/null
sp:2345:respawn:/usr/local/bin/sensorproc 2>/dev/null

The first two-letter indicator is just an identifier, the path names are 
specified, and "respawn" means to restart it when it's killed. "init Q" 
will cause /etc/inittab to be re-read.

     It works very well for me.

-- 
  ------------------------------------------------------------------------
  Brian Fahrländer                 Christian, Conservative, and Technomad
  Evansville, IN                              http://Fahrlander.net/brian
  ICQ: 5119262                         AOL/Yahoo/GoogleTalk: WheelDweller
  ------------------------------------------------------------------------




More information about the ubuntu-users mailing list