Cleaning Postfix queues

From MyWiki

Revision as of 15:27, 16 April 2014 by Admin (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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
Personal tools