daemontools

daemontools is a collection of tools for managing UNIX services. It monitors qmail services and saves error messages to one or more logs.

First of all, let's create the folder which will host qmail, daemontools and ucspi-tcp:

mkdir /var/qmail

In this guide I will assume that all the source packages have been downloaded into the /usr/local/src folder.

cd /usr/local/src
wget http://www.qmail.org/netqmail-1.06.tar.gz
wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz

Unpack netqmail (it'll be compiled and configured shortly):

tar xzf netqmail-1.06.tar.gz
chown -R root.root netqmail-1.06

Note that the patches for daemontools are stored in the /usr/local/src/netqmail-1.06/other-patches directory.

cd /var/qmail
tar xzf /usr/local/src/daemontools-0.76.tar.gz
cd admin
ln -s daemontools-0.76 daemontools
chmod 1755 .

So you have daemontools in /var/qmail/admin/daemontools

Now let's apply the patch and install

cd daemontools
patch -p1 < /usr/local/src/netqmail-1.06/other-patches/daemontools-0.76.errno.patch
package/install

Note that package/install will also add a line to the end of /etc/inittab to automatically launch scanboot (if it doesn’t already find the line there).

Add the "clear" service, so that you can easily clear the readproctitle service errors line:

cd ../
mkdir clear
touch clear/down

cat > clear/run <<EOF
#!/bin/sh
yes '' | head -4000 | tr '\n' .

# When you want to clear the service errors, just run this:
# svc -o /service/clear
EOF

chmod +x clear/run
chmod a-w clear/down 

ln -s /var/qmail/admin/clear /service/clear

Finally, since this number of directory levels bothers me:

ln -s /var/qmail/admin/daemontools/command /command

That way, I have almost everything in /var/qmail, except for /command and /service, which are just symbolic links.

Comments

I tried installing daemontools exactly as outlined above.  But qmailctl start fails because it can't find svc, svok, etc.  I researched on the web, and it appears that the issue is with daemontools not being found in the PATH.  I've tried updating the path in /etc/profile, and in /etc/inittab (when launching svscan).  Although ps -ef | grep svscan demonstrates that svscan is running, qmailctl can't seem to find scripts in the /command folder.

(Per your suggestion, I'm trying to do this install on Slackware  (version 13.37).)

I also tried running ./rts > rts.out (as mentioned in Dave Sill's book, "Life With Qmail") but it bombs on every line--again complaining 'command not found' one line after the next.

What am I doing wrong?

Thanks in advance for your response.

-Dave Martin

Hi Dave, first of all thanks a lot for your support.

You should have this PATH inside the /command/svscanboot script:

PATH=/command:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin

qmail should start by means of a line inside /etc/inittab

SV:123456:respawn:/command/svscanboot

so, you may want to check that svscanboot was actually launched on boot, or try to run it manually. I prefer to have it in my rc.local

fyi, I have tested everything on a slackware64 13.37

cheers :)

Roberto

qmailctl start continues to return errors on line 17: svok: command not found 

However, ps -ef | grep svscan returns the following:

root 1886 1 0 Mar10 ? 00:00:00 /bin/sh /command/svscanboot
root 1948 1886 0 Mar10 ? 00:00:02 svscan /service
root 9379 6093 0 01:12 pts/0 00:00:00 grep svscan

Could there be a permissions issue with the qmail user accounts?  Does the qmail group need to be granted permission to in order to run the daemontool utilities?

It's seems like the daemontools' installation has failed... can you post please:

ls -l /command/
ps axfuww

anyway feel free to contact me in private using the contact button above

if your linux using systemd

remove SV:123456:repawn:/command/svscanboot from /etc/inittab

create a file at /lib/systemd/system/daemontools.service
edit as

[Unit]
Description=DJB daemontools
After=syslog.target network.target

[Service]
ExecStart=/command/svscanboot
Restart=always

[Install]
WantedBy=multi-user.target

copy links

ln -s /lib/systemd/system/daemontools.service /etc/systemd/system/multi-user.target.wants

reboot ur system