Empty Postfix Mail Queue | |
---|---|
Subject: | |
Empty Postfix Mail Queue This command will delete one specific email from the mailq (taken from the postsuper man page) mailq | tail +2 | grep -v '^ *(' | awk 'BEGIN { RS = "" } { if ($8 == "email@address.com" && $9 == "") print $1 } ' | tr -d '*!' | postsuper -d -
I use a few scripts that check the status of our servers and email/page me if they don't respond. This led to a problem when I was offline for one reason or another. I would get a ton of messages sent to the postfix queue which would all be sent out when I reconnected to the internet. Deleting the postfix mail Queue is suprisingly easy: sudo postsuper -d ALL
The other thing that helped with this was checking for a local network connection before doing the server checks. This is done with the following. ifconfig | grep netmask | grep -v 127.0.0.1 | awk {'print $2'}L | |
2015-09-13 15:49:03 | gstlouis |