Tetsu Ushijima

How to set up a qmail delivery service

A qmail delivery service handles mail messages in the queue. It runs qmail-send with three companion programs (qmail-lspawn, qmail-rspawn, and qmail-clean) and uses multilog to store log messages. Both qmail-send and multilog are supervised.


Setting up the service

  1. You will have to make two decisions:

  2. Create the service directory by running the qmail-delivery-conf program:

              qmail-delivery-conf qmaill /var/qmail/service/qmail
  3. Look at the qmail-start invocation in /var/qmail/rc. If you have been telling qmail-start to invoke some logging program, change /var/qmail/rc so that qmail-start won't invoke such a program. Typically this means removing a phrase such as ``splogger qmail'' or ``multilog t /var/log/qmail'' from /var/qmail/rc. See the qmail-start(8) manpage for the detail.

  4. Tell svscan about the new service:

              ln -s /var/qmail/service/qmail /service

    svscan will start the service within five seconds.

  5. Optionally, if you want compatibility with the official qmail documentation, create a symbolic link /var/log/qmail that points to the actual log directory:

              cd /var/log
              test -d qmail && mv qmail qmail.bak
              ln -s /var/qmail/service/qmail/log/main qmail

Testing the service

  1. Check the service status:

              svstat /service/qmail /service/qmail/log

    The output should look something like:

              /service/qmail: up (pid 6345) 6 seconds
              /service/qmail/log: up (pid 6346) 5 seconds

    Run svstat several times and make sure that the process IDs shown do not change.

  2. Check the log messages:

              tail -f /service/qmail/log/main/current | tai64nlocal

    The directory /service/qmail/log/main contains log files to which qmail-send stores the log messages. The output should look something like:

              status: local 0/10 remote 0/20

    qmail-send always prints either ``cannot start'' or ``status''.

  3. Use ps to browse the process tree. It should contain the following portion:

              svscan /service
                supervise qmail
                    qmail-lspawn ...
                supervise log
                  multilog t ./main

    Two new supervise processes should have been added as svscan's children, one for qmail-send (running as qmails) and the other for multilog (running as qmaill). The process IDs of qmail-send and multilog should match with svstat's output. You will see qmail-send have three children: qmail-lspawn, running as root; qmail-rspawn, running as qmailr; and qmail-clean, running as qmailq. All these processes should be idle at this time.

  4. Follow the instructions in TEST.deliver (in /var/qmail/doc or in the qmail source directory), starting at step 3. Note that the log messages are stored in /service/qmail/log/main/*, not in syslog.