Delete exim queue via ssh?

bmcpanel

Well-Known Member
Jun 1, 2002
544
0
316
Hi. Due to spamming, spoofing from fields, etc., etc., etc., I am finding it necessary to spend more time to clear the exim queue from time to time. I went about 5 days last week without cleaning the queue, and there were over 9,000 messages in the queue (all undeliverable mail so exim kept them in the queue to retry them over and over again... zzzzz)

Anyway, after that I set all accounts to :fail: , but now, I still need to clean the queue on a regular basis due to filthy spammers.

Thus, my question is, instead of doing this from within WHM, I would like to run a cron tab to do this. While in SSH, what command would I use to delete the queue just like is performed in WHM?

Thanks.
 

freedman

Well-Known Member
Feb 13, 2005
314
5
168
exim cheatsheet

http://bradthemad.org/tech/notes/exim_cheatsheet.php


I have the following script to clear out boxtrapper messages which are stuck in the exim queue:

you can modify it as needed to solve your problem:
#!/bin/sh
exim -Mrm `grep -lr 'To complete this verification, simply reply' /var/spool/exi
m/input/ | sed -e 's/^.*\/\([a-zA-Z0-9-]*\)-[DH]$/\1/g'` 2> /dev/null
 

jesmarcelo

Registered
Mar 21, 2006
3
0
151
bmcpanel said:
Hi. Due to spamming, spoofing from fields, etc., etc., etc., I am finding it necessary to spend more time to clear the exim queue from time to time. I went about 5 days last week without cleaning the queue, and there were over 9,000 messages in the queue (all undeliverable mail so exim kept them in the queue to retry them over and over again... zzzzz)

Anyway, after that I set all accounts to :fail: , but now, I still need to clean the queue on a regular basis due to filthy spammers.

Thus, my question is, instead of doing this from within WHM, I would like to run a cron tab to do this. While in SSH, what command would I use to delete the queue just like is performed in WHM?

Thanks.

exim -bp | grep \< | awk '{print $3}' | xargs exim -Mrm
 

bmcpanel

Well-Known Member
Jun 1, 2002
544
0
316
Thanks guys. The examples work just fine. I have a cron job setup and this will help me automate one of the boring server tasks for me. Thanks again!
 
Last edited:

nxds

Well-Known Member
Jan 6, 2006
53
0
156
mambovince said:
I run the following, slightly different:

PHP:
exim -bpru|grep frozen|awk {'print $3'}|xargs exim -Mrm
- Vince
Alternatively use exiqgrep:

PHP:
exiqgrep -zi | xargs exim -Mrm
This is also good for removing failed delivery messages to (likely) non-existent senders:
PHP:
exiqgrep -i -f '<>'  | xargs exim -Mrm