I recently had to setup daemontools on a CentOS system. I had set it up before but it had been a while. So I Google’d around and found very little and what little I did find wasn’t very helpful. So here is a quick and dirty on setting up daemontools. I even included the CentOS fix that I came across to make it compile. There is also a patch version (if you were building an RPM), but I prefer just making the change in this case; it’s much simpler.
This part can be tricky on CentOS 5 systems now because of some errno.h issues. Credit where credit is due, I initially found my answer here: http://syslog.warten.de/2008/07/bernsteins-daemontools-install.html
In short, the trick is to change the first line in the packages/conf-cc file to read as follows:
2) Add these lines to your /etc/rc.local.
csh -cf '/command/svscanboot &'
Also make sure that your /etc/rc.local is executable.
3) Make sure the directories named /service and /var/service exist. Going with what I am setting up (Gearman) at the moment, let’s get a service setup.
[root@server service]# ln -s /var/service/gearman /service/gearman
4) Now we add the gearman/run file used for starting up the daemon.
echo "Starting gearman"
# Note that --daemon isn't here because we want it running in the 'supervise' foreground
exec gearmand --user=gearman --queue-type=libmemcached
5) Finally make sure that your run file is executable.
6) Right from here, we are all setup that the /service directory will be scanned on the next reboot and all of the /service/**/run files will be executed. This is the ideal way to If you want to start everything up from here. However, I know that restarting a machine isn’t always a possibility. Therefore you can start up all services in your /service/ directory like this:
Anything further, I strongly suggest you read the daemontools documentation here.