Jack Hacks

Friday, January 22, 2010, 07:34 PM ( 1 view ) - Linux - Posted by Administrator
Here are some helpful hints on exim administration. All of the commands are formated for debian (exim4) but are also tested on centos (exim).

List message count in message queue:
# exim4 -bpc

List all messages in the queue, sorted by date:
# exim4 -bp

Print message headers:
# exim4 -Mvh 1NY1cq-0003jb-Qh

Print message body:
# exim4 -Mvb 1NY1cq-0003jb-Qh

Print message logs:
# exim4 -Mvl 1NY1cq-0003jb-Qh

Remove message from queue:
# exim4 -Mrm 1NY1cq-0003jb-Qh

Force message delivery:
# exim4 -M 1NY1cq-0003jb-Qh

Print count of all messages
- from specified sender (From:):
# exiqgrep -f "user@domain.com" -c

- from specified sender domain:
# exiqgrep -f "domain.com" -c

- for specified recipient:
# exiqgrep -r "user@domain.com" -c

Print message IDs for all messages from specified sender and pipe them to exim for deletion:
# exiqgrep -f "user@domain.com" -i | xargs exim4 -Mrm

Sometimes exiqgrep throws an error for nonexistent message or so, commonly caused by frequent server restarts or out of disk space conditions. This is easily fixed by deleting the printed message ID. But sometimes these errors are too many to fix one by one. To get around the problem I use a simple bash script (tested on debian and centos):

while [ -n "`exiqgrep -r 'president' 2>&1 | awk '{if($3 != "id")print $4}' | xargs exim4 -Mrm`" ]; do echo Deleting erroneous message...; done


It is always useful to collect some statistics on any running service. For exim you can do it like this:
# tail -20000 /var/log/exim4/mainlog | eximstats -nr | less
Depending on your exim configuration it could be meaningful or not :)

Hope the above would help anyone.
permalink  | 

| 1 | 2 | Next> Last>>