Created
June 25, 2015 18:17
-
-
Save aymencis/2940fd785e2e2f03657b to your computer and use it in GitHub Desktop.
SPAM CHECK ON POSTFIX MAIL QUEUE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
NB=$(/usr/sbin/postqueue -p | wc -l) | |
[email protected] | |
MAIL="/tmp/mailspam" | |
LIMIT=600 | |
echo START CHECKING SPAM $(date) > $MAIL | |
echo "" >> $MAIL | |
if [ $NB -gt $LIMIT ] | |
then | |
echo THERE IS $NB MAIL IN QUEUE , PLEASE TAKE A CLOSE LOOK >> $MAIL | |
echo "" >> $MAIL | |
cat $MAIL | mail -s "SPAMQUEUE REPORT" $CONTACT | |
else | |
echo $NB less than $LIMIT >> $MAIL | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment