Cleaning Postfix queues

From MyWiki

(Difference between revisions)
Jump to: navigation, search
m (Protected "Cleaning Postfix queues" ([edit=sysop] (indefinite) [move=sysop] (indefinite)))
(added reference link)
 
Line 18: Line 18:
# mailq | tail -n +2 | awk 'BEGIN {RS=""} {print $NF}'|sort |uniq -d -c
# mailq | tail -n +2 | awk 'BEGIN {RS=""} {print $NF}'|sort |uniq -d -c
</pre>
</pre>
 +
 +
 +
Reference
 +
 +
[1] [http://www.howtoforge.com/delete-mails-to-or-from-a-specific-email-address-from-postfix-mail-queue, How To Delete Mails From Or To A Specific Email Address From Your Mail Queue (Postfix)]

Current revision as of 14:02, 20 April 2014

I found out that PureMessage Postfix qshape is not returning correct numbers or takes long to process queue directory and something low level like this helps to get the correct ones:

# find /opt/pmx6/postfix/var/spool/mqueue/deferred ! -type d | wc -l

And sometimes you didn't have your Postfix set right to ditch all those test emails and it blows away your deferred queue. To clean it run the below as root:

# mailq | tail -n +2 | awk 'BEGIN {RS=""} /@dummy\.com/{print $1}' | tr -d '*!' | postsuper -d -
# mailq | tail -n +2 | awk 'BEGIN {RS=""} /@test\.com/{print $1}' | tr -d '*!' | postsuper -d -
# mailq | tail -n +2 | awk 'BEGIN {RS=""} /@example\.com/{print $1}' | tr -d '*!' | postsuper -d -

To get numbers of stuck emails:

# mailq | tail -n +2 | awk 'BEGIN {RS=""} {print $NF}'|sort |uniq -d -c


Reference

[1] How To Delete Mails From Or To A Specific Email Address From Your Mail Queue (Postfix)

Personal tools