Purging frozen messages from Exim

by rjamestaylor on January 13, 2010

There’s probably a better way to do this. (If so, leave a comment!) However, I run a debian server for a small task and use the default MTA Exim for mail delivery of status updates to my main mail accounts. Usually I run Postfix or Sendmail. I even have to support Qmail on occasion. However Exim is unfamiliar territory for me — I’m an Exim n00b.

Recently I decided I wanted to remove the “frozen” messages seen by running the mailq command. For example:


# mailq
48h 1.6K 1NUQLB-0007BC-QL <> *** frozen ***
user@domain.tld

48h 1.6K 1NUQO9-0007CW-1u <> *** frozen ***
user@domain.tld

48h 1.6K 1NUQOG-0007CY-1f <> *** frozen ***
user@domain.tld

48h 1.6K 1NUQOG-0007CZ-1v <> *** frozen ***
user@domain.tld

48h 1.6K 1NUQP4-0007DH-Af <> *** frozen ***
user@domain.tld

I know they’ll be purged eventually, I just wanted to clear the queue for some quick testing I was performing. The documentation I found on-line mentioned running “exim -Mrm <id>” for each message id in the mailq output. Being lazy, I don’t want to run that each time — I want a simple one-line command to purge frozen messages. So, I wrote the following BASH script that parses the mailq output and executes the command for each message id:

for i in `mailq | awk '$6 ~ /^frozen$/ {print $3}'`; do exim -Mrm $i; done

Worked like a charm! Message queue emptied of frozen messages.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Ping.fm
  • StumbleUpon
  • Technorati
  • Tumblr
  • TwitThis
  • Fark
  • FriendFeed
  • HackerNews
  • Posterous
  • Slashdot

Comments on this entry are closed.