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.

April 4, 2011Permalink 17 Comments
17 Responses to daemontools on redhat enterprise 6.0
  1. Shawn says:

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

  2. Arjan Koole says:

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

  3. Steve says:

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

  4. Arjan Koole says:

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

  5. Arenstar says:

    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. Arjan Koole says:

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

  7. Toby says:

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

  8. Arjan Koole says:

    glad to be of help! :)

  9. Me says:

    very helpful, thanks!

  10. Arjan Koole says:

    You’re welcome! :-)

  11. CharlesGnarly says:

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

  12. Arjan Koole says:

    Glad to hear it, you’re welcome :)

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

    Adding

    stop on runlevel [!3]

    fixes issue with reboot

  14. Arjan Koole says:

    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?

  15. Ruben says:

    Hi!
    in order to reboot some daemon which is best approach? restarting entire daemon tool service?

    initctl start svscan

    For example, suppose we want to reload apache configuration, we have setup daemon tools service to monitor htppd, now, in RedHat 6, how must we reload or restart apache service which is being monitored by Daemon tool?

    ThankS! :)

  16. Arjan Koole says:

    When using the setup described in this post:

    cd /service
    /command/svc -t

    where service is the directory name, without a tailing /. So, if you for example have named the service directory httpd, the command would be:
    /command/svc -t httpd

  17. Miguel Cabrerizo says:

    Thanks man!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">