PDA

View Full Version : qMail how to show number of queued mails and empty queue?



Fli
10-19-2013, 01:44 PM
Hi, please how one can see how many emails are in qmail queue and how to empty that queue?

-------
EDIT: I think i found it.

Number of queued mails in qmail can be seen when doing command:
/var/qmail/bin/qmail-qstat
To empty queue, one should stop qmail, then empty appropriate folders in /var/qmail/queue/
and start qmail again.

Example i did these commands (do on your own risk).

to show number of queued mails

/var/qmail/bin/qmail-qstat

to see sizes of the queue subfolders:

du /var/qmail/queue/ -h --max-depth=1

These are folders in my case: bounce info intd local lock mess pid remote todo

first backup queue folder by command:

/sbin/service qmail stop;cp -R /var/qmail/queue/ /var/qmail/queue_bckp/;/sbin/service qmail start
so you can restore it in case of problems

to stop qmail, empty ALL queue folders:

service qmail stop
find /var/qmail/queue/$i -type f -delete
service qmail start

or a bash script can be used:

#!/bin/sh
/sbin/service qmail stop
for i in bounce info intd local mess remote todo; do
find /var/qmail/queue/$i -type f -delete;
done
/sbin/service qmail start

in my case "lock" and "pid" folders was left, not emptied.