How to clear the qmail queue

I recently needed to clear down a qmail queue.  There were no valid emails on the server but the queue was full of failed spam (blocked)

This script clears the queue.

[/sourcecode]#!/bin/bash
cd /var/qmail/queue
rm -rf info intd local mess remote todo

mkdir mess

for i in `seq 0 22`; do
mkdir mess/$i
done

cp -r mess info
cp -r mess intd
cp -r mess local
cp -r mess remote
cp -r mess todo

chmod -R 750 mess todo
chown -R qmailq:qmail mess todo

chmod -R 700 info intd local remote
chown -R qmailq:qmail intd
chown -R qmails:qmail info local remote[/sourcecode]

If your qmail queue is in a different location modify the cd command to the relevant directory.

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.