Linux – How to make daemontools run a simple service without manually calling supervise

daemontoolslinuxUbuntu

Based on various start guides on the web, the sequence of steps I'm using to go from no daemontools installed to having a simple service running automatically is the following (on Ubuntu 14.04):

$ sudo apt-get install daemontools
$ sudo apt-get install daemontools-run # not clear if this is necessary
$ sudo apt-get install csh             # unsure why csh would be needed to run dt
$ sudo mkdir /service
$ sudo mkdir /service/test
$ sudo chmod 1755 /service/test
$ vi /service/test/run                 # see below
$ vi /etc/rc.local                     # see below
$ # tried power cycling here too
$ sudo svstat /service/test            # Why is supervise not running here?
/service/test/: supervise not running
$ sudo supervise /service/test/ > /dev/null &
[1] 2747
$ sudo svstat /service/test/
/service/test/: up (pid 2758) 1 seconds

#########################################################

# contents of /service/test/run:
#!/bin/sh
echo Running service
exec echo hello

#########################################################

# contents of /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
csh -cf '/usr/bin/svscanboot &'
exit 0

Also, running svscanboot manually seems to terminate immediately (does not appear in ps aux output if I run in the background either). What set up steps am I missing, or what am I doing wrong?

Best Answer

I know this is an old question but I had the same problem while installing daemon tools from source.

I then installed the package daemontools-run and it started working.

I went still a little further and tried to look around what was new. I found a file at /etc/inittab with the following call:

    #-- daemontools-run begin
    SV:123456:respawn:/usr/bin/svscanboot
    #-- daemontools-run end
Related Topic