'mail/checkdelivery.sh' hinzufügen
This commit is contained in:
parent
85ebdc29e1
commit
ca16c4bc56
12
mail/checkdelivery.sh
Normal file
12
mail/checkdelivery.sh
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
MAX=100
|
||||||
|
COUNTER=$(grep 'non-delivery notification' /var/log/mail.log | wc -l)
|
||||||
|
|
||||||
|
if [ "$COUNTER" -gt "$MAX" ]; then
|
||||||
|
OUTPUT=$(grep -B 3 -A 2 'non-delivery notification' /var/log/mail.log | head -n 150 | tail -n 25)
|
||||||
|
TEXT="!!WARNING!!\ngrep resulted in more than $MAX 'non-delivery notifications'.\n\n$OUTPUT"
|
||||||
|
echo "delivery notifications are larger than $MAX... Sending Mail...";
|
||||||
|
printf "$TEXT" | mail -s "Mail Administration" -a from:mc8051@schuetrumpf.net niklas@schuetrumpf.net
|
||||||
|
# printf "$TEXT"
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user