I'm looking into different services that help keep processes up and running (auto-restart in the event of a crash). Which ones do you prefer and what are your commends/suggestions? Here are a few methods I've found:

  1. respawn in /etc/inittab
  2. supervise with daemontools
  3. runit
  4. upstart
  5. monit

Personally, I had a bad experience with monit not properly respawning processes so I have to recommend against it. I'm currently using daemontools and it's working quite well so far.


daemontools is indeed well proven; the license isn't even problematic anymore, I don't think.

And its FAQ compares it to inittab, which you asked about.

| improve this answer | |

If you want simple, I'd go with runit. It will restart the service once a second until it is consistently up, can replace scripts in /etc/init.d with a tiny bit of handywork, and has consistent handling all the way around.

The only shortcoming I've had is figuring out single-shot always-on services (services that "start" but in reality exit while leaving a flag that they are "running", i.e. /etc/init.d/networking really isn't a service but acts like one), there's a bit of hand-holding that goes with it to get that behavior. Most people introduce a secondary tool to suspend the run script from terminating, or infinite-loop it with a sleep, etc. so that it won't exit the script. When you issue sv stop <service> it then TERMinates the shell and everything proceeds "as normal".

| improve this answer | |

launchd solves this problem and many more. According to the wikipedia article:

The launchd daemon is essentially a replacement for init, rc, the init.d and rc.d scripts, SystemStarter (Mac OS X), inetd and xinetd, atd, crond and watchdogd.

It's prolific in the mac world, but it is open source and there's no reason you can't use it in linux. Ubuntu considered using it but the license was incompatible at the time (it has since been changed to the Apache license).

| improve this answer | |

Quagga routing suite has watchquagga, which is tailored to that suite's needs. Not sure if it can be used with any generic daemon.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.