Postfix queue management
Never been in a situation where your primary mail server is being delivering a newsletter (for instance), which could be a very long process, and you are sitting in front of your mail client waiting for an urgent mail, which won’t be delivered until the mail server queue is empty?
There is very useful tool provided with Postfix which could save us in those kind of situations (at least, it saved me multiple times) : postsuser. postsuser helps in the management of the mail queue.
A few useful commands:
postsuper -h: moves message to the hold queuepostsuper -r: requeue messagespostsuper -d: delete all messages
Just found a good blog entry on that topic at the following URL: http://blog.gtuhl.com/2008/08/14/basic-postfix-queue-management
So in an urgent situation, where I want to receive all mails which contain clari (my lastname) now, I am using the following (a Bash/Linux guru would probably do it with a more complex and powerful command line, but this works) :
cd /var/spool/postfix/active
grep -L clari * | postsuper -h -
This change the current directory to the one holding active queue mails, then with the grep command sends to stdout all filenames of mails which do not contain my lastname and postsuper reads on stdout to put them on hold. Once done, after a couple of second my urgent mails are delivered.
Then, don’t forget to requeue messages from the hold queue! This can be done thanks to the following:
postsuper -r ALL
Comments are closed.