These install instructions were once part of the BLFS book (see Beyond Linux From Scratch), but for some reason they have been removed. I have modified the instructions to reflect my personal taste.
Download (HTTP): http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
Download size: 36 KB
Estimated Disk space required: 1.8 MB
Install daemontools by running the following commands:
tar xvzf daemontools-0.76.tar.gz && cd admin/daemontools-0.76 && patch -Np1 -i ../../daemontools-0.76.errno.patch && package/compile && cd package && sed 's|/command|/usr/sbin|' boot.inittab > boot.inittab~ && mv -f boot.inittab~ boot.inittab && cd ../command && sed -e 's|/command:/usr/local/bin:/usr/local/sbin:||' \ -e 's|/command/svc|/usr/sbin/svc|' svscanboot > svscanboot~ && mv -f svscanboot~ svscanboot && chmod +x svscanboot && /bin/cp * /usr/sbin && cd ../package && cat /etc/inittab boot.inittab > /etc/inittab~ && mv -f /etc/inittab~ /etc/inittab && mkdir /service && telinit Q
Man pages are not included in the tarball, so install this package if you want online help with the daemontools programs:
tar xvzf daemontools-0.76-man.tar.gz && cd daemontools-man && gzip *.8 && cp *.8.gz /usr/share/man/man8
You should see approximately this in the output:
Most of the commands deal with avoiding the /command directory. There are very few packages out there that use it, so you might not want to create it. I strongly suggest creating the /service directory though.
cd admin/daemontools-0.76: First off, the package is unpacked in an admin directory. You will find the actual packages two directory levels below this.
package/compile: This command actually compiles the source and prepares the binaries.
Since we are installing the binaries in /usr/sbin rather than creating a non-standard /command directory, several paths have to be changed:
sed 's|/command|/usr/sbin|' boot.inittab > boot.inittab~ && mv -f boot.inittab~ boot.inittab
In boot.inittab, /command/svscanboot is changed to /usr/sbin/svscanboot.
sed -e 's|/command:/usr/local/bin:/usr/local/sbin:||' \ -e 's|/command/svc|/usr/sbin/svc|' svscanboot > svscanboot~ && mv -f svscanboot~ svscanboot
Here various paths are adjusted in the svscanboot script.
/bin/cp * /usr/sbin
We must manually copy the binaries to the /usr/sbin directory.
cat /etc/inittab boot.inittab > /etc/inittab~ && mv -f /etc/inittab~ /etc/inittab
These commands append a line to /etc/inittab so that init will launch the svscanboot script.
This command creates the daemontools control directory, which - even if empty - needs to exist for daemontools to run properly.
This command tells the init process to re-read its configuration file (inittab) and act upon any changes that have been made. The svscanboot script is started.
The daemontools package contains svscanboot, svscan, supervise, svc, svok, svstat, fghack, pgrphack, readproctitle, multilog, tai64n, tai64nlocal, setuidgid, envuidgid, envdir, softlimit and setlock. More detailed descriptions of these commands may be found at http://cr.yp.to/daemontools.html.
svscanboot is simply a script that calls svscan and pipes its output to readproctitle.
svscan checks the service directory for daemons to run and starts a supervise process for each run script that it finds.
supervise runs the run script passed to it by svscan and monitors the process the script starts so that if it dies, supervise restarts it.
svc sends signals to processes being run under supervise.
svok checks to see that supervise is running in the directory passed to it.
svstat prints the status of processes monitored by supervise.
fghack prevents processes from putting themselves into the background.
pgrphack runs a process in a separate process group.
readproctitle displays log entries in the output of ps.
multilog is a logging program. It takes output from a daemon and appends it to any number of logs.
tai64n is a timestamp generating program.
tai64nlocal converts output of tai64n into a human readable format.
setuidgid runs a specified program under a given account's UID and GID.
envuidgid performs the same function as setuidgid, but sets environment variables UID and GID equal to the UID and GID of the account specified.
envdir runs a given program with environment variables specified by files in a directory.
softlimit allows resource limits to be set for a given program.
setlock locks a file and runs a program.