Home > Linux, projects, work > daemontools on redhat enterprise 6.0

daemontools on redhat enterprise 6.0

April 4th, 2011

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.

Linux, projects, work , , ,

  1. Shawn
    July 15th, 2011 at 17:06 | #1

    many thanks,i am building qmail on my rhel6,now it works,thanks.

  2. July 18th, 2011 at 08:25 | #2

    You’re welcome. Glad I could be of service to someone. :)

  3. Steve
    July 31st, 2011 at 11:10 | #3

    Cheers, just ran into this problem and your quick and accurate guidance helped get things working :)

  4. July 31st, 2011 at 18:55 | #4

    Glad to hear I could be of some help mate :)

  5. Arenstar
    October 13th, 2011 at 17:37 | #5

    I do believe on Centos 6..
    starting on runlevel [12345]
    caused an unexpected kernel panic on shutdown/restart..
    some bug about the filesystem not being mounted.. etc etc..

    Anyways..
    starting on runlevel [3] only
    fixed my problem

    I realise this is for version 5, but it shows the centos mentality of runlevels
    http://www.centos.org/docs/5/html/Installation_Guide-en-US/s1-boot-init-shutdown-sysv.html

  6. October 13th, 2011 at 17:49 | #6

    Good point. I changed it to [345], which covers the only proper run-levels.

  7. October 18th, 2011 at 23:32 | #7

    Thanks for this – just been installing my first RH6 server with daemontool and this saved me a lot of time!

  8. October 19th, 2011 at 14:20 | #8

    glad to be of help! :)

  9. Me
    November 3rd, 2011 at 04:36 | #9

    very helpful, thanks!

  10. November 3rd, 2011 at 07:37 | #10

    You’re welcome! :-)

  11. CharlesGnarly
    November 22nd, 2011 at 05:01 | #11

    Thanks very much! Just what I was looking for :-)

  12. November 22nd, 2011 at 09:38 | #12

    Glad to hear it, you’re welcome :)

  13. December 6th, 2011 at 20:12 | #13

    @Arenstar
    System halted for me when rebooting with this settings.

    Adding

    stop on runlevel [!3]

    fixes issue with reboot

  14. December 22nd, 2011 at 14:06 | #14

    Sergey Stukov :
    @Arenstar
    System halted for me when rebooting with this settings.
    Adding
    stop on runlevel [!3]
    fixes issue with reboot

    I would recommend using [!345] there. I’ll try to reproduce this soon. This was with Centos 5, right?

  1. No trackbacks yet.