#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
export PATH
STATUS_OK="Mail queue is empty"
STATUS=`postqueue -c /etc/postfix -p`
MAIL_INFO=`postqueue -c /etc/postfix -p|grep '@'`
if [ "${STATUS_OK}" != "${STATUS}" ]
then
for i in `postqueue -c /etc/postfix -p |grep -P '(d+:){2}d+' |
linuxjishu/13830.html target=_blank class=infotextkey>awk '{print $1}'`
do
if echo "$i" |grep -vq '*'
then
echo "${MAIL_INFO}" >>/opt/mail.log
sudo postsuper -d $i
fi
done
fi