the djb way

qmail


q-tips

Quick reference to qmail operations.

checking qmail services

Check qmail services with daemontools svstat utility:

# cd /service
# svstat qmail-*

The output shows the installed qmail services are supervise'd and running.

starting/stopping all qmail services

Stop all qmail services:

# svc -d /service/qmail-*

Start all qmail services:

# svc -u /service/qmail-*

Stop/restart all qmail services:

# svc -du /service/qmail-*

start/stop selected qmail services

Sometimes it may be necessary to stop/start a particular qmail service, or set of selected services, for maintenance, migration, etc.:

# cd /service
# svc -d qmail-smtpd qmail-pop3d

reload control/* files

Whenever the control/locals or control/virtualdomains control files are modified, send the qmail-send service a HUP signal:

# svc -h /service/qmail-send

These are the only two control files reloaded with a SIGHUP. Other qmail-send control files --bouncefrom, bouncehost, doublebouncehost, doublebounceto, etc.-- are reloaded only by stopping and restarting the qmail-send service:

# svc -t /service/qmail-send

Of course, restarting qmail-send will reload the locals and virtualdomains control files also.

checking the queue

qmail includes a couple utilities to check the queue. To get a summary report, use qmail-qstat. To get a more detailed listing, use qmail-qread.

Alternatively, set up a qmail-qstat service, then use the qstat client to check the queue of a local or remote server.

To see a listing of remote hosts that have a time-out flag, use the qmail-tcpto utility.

manually run the queue

To attempt immediate delivery for messages in the queue, give the qmail-send service an ALRM signal:

# svc -a /service/qmail-send

qmail also sets a time-out flag for remote hosts on which the connection attempt timed-out. Once the time-out flag is set, qmail waits one hour before retrying another delivery to that IP address. The ALRM signal will make qmail retry these hosts too, but only after the time-out flag has expired.

To clear any time-out flags set for remote hosts, and to retry immediate delivery for all messages in the queue, first run the qmail-tcpok utility:

# /var/qmail/bin/qmail-tcpok
# svc -a /service/qmail-send

These commands are easily wrapped in a simple shell script; here's one named qkick, after one described on John M. Simpson's qmail page:


#!/bin/sh
# qkick: reset time-out flags and re-run the queue
# ===
/var/qmail/bin/qmail-tcpok && /command/svc -a /service/qmail-send

### that's all, folks!


Copyright © 2004, Wayne Marshall.
All rights reserved.

Last edit 2004.09.03, wcm.