Thursday, October 16, 2008

Flush out deferred mails (Postfix)

linux kernel system uptime route program HPUX AIX solaris sparc 32bit 64bit platform korn bash
Here's the simple script. This was used on Redhat 7.2(Enigma) runnning Postfix as the MTA
awk unix perl tar gzip rpm
#!/bin/sh
DEFERDIR=/var/spool/postfix/deferred
TMPFILE=/tmp/listMailer
mailq | grep MAILER-DAEMON | cut -f1 -d ' ' > $TMPFILE
for DEFERFILE in `cat $TMPFILE | grep -v *`
do
/usr/sbin/postsuper -d $DEFERFILE deferred
done