Last active
August 29, 2015 14:08
-
-
Save pawel-dubiel/053e0c784b004adc3214 to your computer and use it in GitHub Desktop.
count mails
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/bash | |
#count_email_log | |
#add to cron | |
#59 23 * * * root /bin/count_email_log | |
IFS='%' | |
touch /var/www/mail.txt || exit | |
VOUTME="$(mktemp)" | |
VCURRENTDATE=$(date "+%b %-d") | |
VCURRENTDATEFULL=$(date "+%b.%-d.%y") | |
grep "$VCURRENTDATE" /var/www/mail.txt > $VOUTME | |
VCOUNT="$(grep -c "Message accepted for delivery" "$VOUTME")" | |
echo "$VCURRENTDATEFULL $VCOUNT emails sent" >> /var/www/mail.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment