How do I chose between upstart, runit, supervisor, daemontools, ... for restarting a process if it dies? (process supervision / monitoring)

Solution 1:

  • runit is a successor to daemontools (both are written in c)

  • supervisord uses python.

I've been using runit with socklog by the same author inside Alpine Linux lxc containers for around 10 months to manage web / database & various other services. It is light, easy to manage & I have had no service failures. The logging daemon also runs as it's own user & not root which is nice.

voidlinux uses runit as it's init system & also for service supervision (search the package tree for run files for examples of runit scripts).

Solution 2:

If your distro uses Upstart, go with it. It has very basic support for job restarting, but includes limits that can prevent from restart loop, as mentioned by @EEAA.

If your OS uses another init program, don't change it. I can't really help you with the other tools you mentioned, as I generally use Ubuntu where Upstart is still present (as of the latest LTS), so I have little to do with them. But it's not a hard task to create a simple script which is run from cron once a minute (or more frequently in ie. a loop), which can check if a PID exists and issue restart on failure.