July 26, 2017

How to Install Daemontools on FreeBSD

FreeBSD Logo

Daemontools is mainly used for controlling processes, and maintaining logfiles. Daemontools can start services and restart services if they die. All it needs is a directory with a run script that runs the service. Additionally you can save error messages to one or more logs.
This includes timestamps at each line and for each log and it can include or exclude lines matching specified patterns. Also it can automatically rotate logs to limit the amount of disk space used. For more information, please visit Daemontools.

Root access is required to edit the following files and to execute commands. Log in as root (su) or simply prepend sudo to all commands that require root privileges.

Install Daemontools

Install Daemontools from the FreeBSD ports tree.

cd /usr/ports/sysutils/daemontools
make install clean; rehash

Setting up Daemontools

To get svscan running we need to create the /var/service directory.

mkdir /var/service

You also need to add an entry to the /etc/rc.conf to start svscan on system start.

echo 'svscan_enable="YES"' >> /etc/rc.conf

Starting svscan

Now start the svscan server with the following command:

/usr/local/etc/rc.d/svscan.sh start

Run ps -auxw | grep svscan to see that svscan is running.

root 384 0.0 0.0 1652 8 con- I 20Oct12 14:47.15 /bin/sh /command/svscanboot
root 404 0.0 0.0 1244 140 con- S 20Oct12 10:10.54 svscan /var/service

Speak Your Mind