[GRLUG] Bash split question, ..
Godwin
godwin at grandrapids-lug.org
Tue May 31 21:37:35 EDT 2011
I suspect what you're after is auto cleaning of the mail queue. Here are a
couple of things I do that may help...
this (theoretically) issues a call to the 'postsuper' command with a single
parameter until it exhausts the list of problematic email entries in the
queue.
cron entry (run every 10 mins):
# Delete MAILER-DAEMON entries from mail queue
*/10 * * * * /etc/postfix/scripts/queue-cleanup.sh
[me at smtp me]% less /etc/postfix/scripts/queue-cleanup.sh
#!/bin/bash
/usr/bin/mailq |grep --color=none MAILER-DAEMON | awk '{print $1}' | tr -d
'*!' | xargs -n 1 postsuper -d >/dev/null 2>&1
--------------------------------------------------------------------------------
And this let's me know which messages are being HELD (I hold some based on a
criterion).
[me at smtp me]% crontab -l|grep -i mailq
*/10 * * * * /home/users/me/bin/monitor_mailq.sh
[me at smtp me]% less ./bin/monitor_mailq.sh
------------------------------------------------------------------------------------
#!/bin/bash
# This script will monitor the mail queue for messages on HOLD
# and e-mail me if/when it finds one.
# 1-April-2005 Godwin
recipient=operator
HELD=`/usr/sbin/postqueue -p | grep \! | cut -d'!' -f1`
if [ ! -z "$HELD" ]; then
echo "Message id $HELD is being held for review." | mail -s "Message HELD"
$recipient
fi
------------------------------------------------------------------------------------
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shinobu.grlug.org/pipermail/grlug/attachments/20110531/74242e5e/attachment.html>
More information about the grlug
mailing list