Forcefully clearing the qmail queue

If you have the need to forcefully delete everything in the qmail queue, simply run this shell script (thanks to Florian on this one):

#!/bin/sh
# remove everything - STOP QMAIL FIRST!
/sbin/service qmail stop
for i in bounce info intd local mess remote todo; do
find /var/qmail/queue/$i -type f -exec rm {} \;
done
/sbin/service qmail start

Tagged , ,

3 thoughts on “Forcefully clearing the qmail queue

  1. Sean says:

    Thanks, that was handy. Cheers!

  2. I needed this badly. Thank you.

    My only suggestion would be to modify the script so that the file names are printed as they are deleted. It would help to have a clear indicator the script is working.

  3. Brooks K says:

    Hey Major,

    I know this article is crazy old, but it popped up in the random articles. Handling the spool directory directly can be a bit bad for Qmail, if you want to delete everything by hand, you should at have “qfixq” (Google will return what you need). With this you can then run /var/qmail/bin/qfixq live empty and it will dump the queue as well as clean up all of the buckets and such that qmail likes to stay clean to avoid any spool corruption. You can also just run qfixq live after manually removing to do a cleanup (ensure qmail is stopped)

    Good luck :)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>