http://cr.yp.to/daemontools.html

I dont use it myself but it apparently does exactly what you want and is 
written by a fairly well known and generally accepted secure code writer and 
author of the Qmail MTA and djbdns apps.

On Monday 04 September 2006 21:13, Donovan Niesen wrote:
> I've been looking for a package that could accomplish something similar to
> "procautostart":
>
> http://www.linuxjunkies.org/html/Process-Monitor-HOWTO.html
>
> Basically it monitors a specific process and if it finds that it failed, it
> issues a command/restarts the process.  This one seemed straight-forward
> enough but I can't seem to get it to compile on my Ubuntu box.  Does
> anybody use this script or something similar to keep a critical process
> alive?