Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

4 Answers 4

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.

share|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).

share|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.

share|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".

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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