Starting and stopping qmail

I wrote a little shell script, which I called qmailq, which is intended to be stored as /etc/init.d/qmailq on Solaris and other systems using this form of startup files. I also put it in /etc/rc2.d/S88qmailq (as a symlink to the former location). To start or stop qmail manually, run the script with an argument of start or stop respectively. It also understands various arguments to signal, check, or restart the daemon.

Important note: This version of the script was made for qmail 1.00. If you run qmail 1.01 instead, please add "./Mailbox", or whatever default delivery instruction you wish to use, as a first argument to qmail-start. (You may have to do other edits as well; for example, some versions of sh have a problem with a commented-out line between a line ending with a backslash and its continuation.)

Watching qmail-send (or any other program)

The above script needs the little program watch (C code here). This is a small program which does tty dissociation, puts the PID of the daemon in a file, and removes said file when the daemon dies for whatever reason.

The program understands the arguments -0, -1, and -2 to mean "do not close this file descriptor". (The usual behaviour of watch is to close the standard file descriptors and reopen them on /dev/null.) This is handy to allow logging to a file, for example. See the qmailq script for an example.


1997-09-28 (minor update 2019-10-15: Add css and meta tags.)