daemontools on redhat enterprise 6.0

So, for a project I needed to get something running in order to insure memcached would keep on running. The (for me) natural choice for this was daemontools (0.76 at time of writing).

There are a couple of things you have to pay attention to, in order to get this going on RHEL 6. (and I suppose many other Linux distro’s)

Phase 1 – get the source and compile it

get the source tarball here (note: this might not be the current version anymore!) and download it to /usr/local/src

  • unpack it with tar -zvxf daemontools-0.76.tar.gz and cd into admin/daemontools-0.76.
  • edit src/conf-cc and add ‘-include /usr/include/errno.h’ at the end of the line. (anywhere is fine, really)
  • run package/install

this should give you the needed files in /command and an existing /service

Phase 2 – fixing startup

Daemontools requires a somewhat different approach to starting up then you might be used to. ( the most common way being /etc/init.d/<name>, and using chkconfig to influence when it starts). Daemontools should be started on boot, and init must be told to restart it when it dies. This ensures continued operation. The installer you ran in phase 1, took care of this by adding a line in /etc/inittab, but that’s an old method, and for the sake of continued operation (and working straight away) we’ll use the new method:

  • Remove the added line from /etc/inittab.
  • cd /etc/init
  • create a new file called svscan.conf, and put the following contents in:
start on runlevel [345]
respawn
exec /command/svscanboot

now, tell init, it should re-read it’s configuration, and then start svscanboot:

  • initctl reload-configuration
  • initctl start svscan

if you check now, you should see a happily running svscan, and daemontools is ready to kick some:

2676 ?        Ss     0:00 /bin/sh /command/svscanboot
2678 ?        S      0:00  \_ svscan /service

Enjoy! I hope this little post was helpful.