How to delete mailqueue for a server?

dotdoms

Verified User
Joined
Oct 28, 2006
Messages
45
Hello,

I got a script which is checking my server which is administered by directadmin and will then send an email to another server of mine with the results. Now unfortunately due to a programming error of mine that script went to infinite loop creating like billions of mails to be sent. Now since days that other server is receiving mails from the first server even though the script is stoped already for days. Obviously the enourmous amount of mails is still in the mailqueue of the server the script ran on.

Now my question would be how can I truncate that mailqueue? I´m running debian sarge as a linux.
 
Someone posted instructions here.

But it's not that simple because you can't just delete all those files with rm -f; there are too many files.

I recommend using the following command, which will remove all messages that have been in the queue for more than XXX seconds. This will take some time to run.
Code:
# exiqgrep -o XXX -i | xargs exim -Mrm
If you don't have the exiqgrep command on your server you can get it here. Be sure to put it in the same directory as the exim daemon, with the same chmod and ownership settings as the exim daemon. And of course rename it to take off the .txt extension.

Jeff
 
It is is pretty simple but it will delete all queued mail and that may not be what you want to do.

Code:
rm -rf /var/spool/exim/input
mkdir /var/spool/exim/input
chown mail:mail /var/spool/exim/input
chmod 710 /var/spool/exim/input
service exim restart

Something a little safer is
Code:
mv /var/spool/exim/input /var/spool/exim/inputOLD

Use at your own risk.
 
Last edited:
Floyd,

You're missing changes which should be made to two other directories. input is not all there is to the queue. There's also msglog and the index.

Jeff
 
I guess its something I need to look into.

I have been regularly deleting from /var/spool/exim/input old queue files for years and never experienced a problem. After deleting the old queue files in /input I do exim -bpc and the queue count is lower.

What am I missing?
 
thx for the input. tried it and hope it will help :)

just as a remark for others with the same problem:
Since I use debian the syntax for restarting is /etc/init.d/exim restart
 
Back
Top