DaemontoolsUpstartConfig

Summary

For those of you who have installed and attempted to get DJB's daemontools (as is required for djbdns/dnscache) running on EdgyEft or later, you may have noticed (at least as of 2006-10-28) that despite svscanboot being added to the end of /etc/inittab (SV:123456:respawn:/command/svscanboot) and sending init a SIGHUP, that it's still not running as expected. The reason is that sysvinit has been replaced with Upstart. What follows is a fix which works for many.

The Fix - Edgy

  • create/edit the daemontools startup file:

$ sudo vi /etc/event.d/svscanboot}}}

  • put the contents of the following in svscanboot:

# svscanboot - DJB's daemontools
#
# This service maintains svscanboot from the point the system is
# started until it is shut down again.

start on runlevel-1
start on runlevel-2
start on runlevel-3
start on runlevel-4
start on runlevel-5
start on runlevel-6

stop on shutdown

respawn
exec /command/svscanboot

The Fix - Feisty

The format of upstart event.d files changed between the Edgy and Feisty releases. The following code works on Feisty with an FHS style install. Place it in a new file in /etc/event.d/. E.g, /etc/event.d/local-svscan.

# svscan - DJB's daemontools
#
# This service starts daemontools (svscanboot) from the point the system is
# started until it is shut down again.

start on runlevel 2
start on runlevel 3
start on runlevel 4
start on runlevel 5

stop on shutdown

respawn
exec /usr/bin/svscanboot

DJB style installs (most likely) will use the following exec command:

exec /command/svscanboot

Validate

  • check svscanboot:

$ sudo status svscanboot
svscanboot (stop) waiting
  • start svscanboot:

$ sudo start svscanboot
svscanboot (start) waiting
svscanboot (start) starting
svscanboot (start) pre-start
svscanboot (start) spawned, process 663
svscanboot (start) post-start, (main) process 663
svscanboot (start) running, process 663
  • check the status (this is a bit redundant given the above result) - you should see something like this:

$ sudo status svscanboot
svscanboot (start) running, process 663
  • check with svstat, eg, with dnscache:

$ sudo svstat /service/dnscache
/service/dnscache: up (pid 670) 621 seconds

Caveats

  • As Upstart is completely new to me, I've discovered that trying to shut down svscanboot with sudo stop svscanboot isn't such a great idea, as it leaves various processes around, such as supervise. That said, I don't believe that DJB ever intended for this subsystem to be stopped. There could be a better way of writing the above config file.

  • The standard (manual) installation of daemontools (at least in Hardy), when adding the (never called) svscanboot line to /etc/local changes the mode of this file and it no longer is executable. Standard ubuntu installations don't have anything in /etc/rc.local, but you may have added something in there (as I did) and ubuntu won't run it. In order to fix this, after installing daemontools you should do the following:

sudo chmod +x /etc/rc.local

DaemontoolsUpstartConfig (last edited 2010-03-08 12:44:48 by 210-122-136-186)