Recreating a mail queue in QMail
Submitted by Bram Schoenmakers on 31 August, 2007 - 11:39.
Maybe it was not so smart to do after all to remove all files in the QMail queue while QMail was running.
# qmailctl queue
...
warning: trouble with #173649: file does not exist
warning: trouble with #173741: file does not exist
warning: trouble with #173994: file does not exist
warning: trouble with #174063: file does not exist
...
...
warning: trouble with #173649: file does not exist
warning: trouble with #173741: file does not exist
warning: trouble with #173994: file does not exist
warning: trouble with #174063: file does not exist
...
The following solution did work for me, but is often a no-go since I just remove the queue and recreate it with the queue-repair script (to be found in the mail/queue-repair in the FreeBSD ports).
- Stop QMail:
# /usr/local/etc/rc.d/svscan.sh stop - Move the queue away:
# mv /var/qmail/queue /var/qmail/queue.old - Run queue-repair:
# queue-repair -n -c -s 23The -n stands for not using the Big Todo Patch in QMail. Use -b if you do use this patch.
The -c stands for recreating the database.
The -s stands for the amount of subdirectories in the queue. Qmail's default is 23. If you want another number for whatever reason (performance), make sure it is a prime number. - And start QMail again:
# /usr/local/etc/rc.d/svscan.sh start
Update 14 September 2007:
This is the proper way of clearing a QMail queue:
- Stop qmail.
-
for i in bounce info intd local mess remote todo; do
find /var/qmail/queue/$i -type f -exec rm -f {} \;
done - Restart qmail.