added the base exim scanner

This commit is contained in:
Benjamyn Love 2018-06-15 15:21:12 +10:00
parent cfc77fc119
commit f7a9f48406
2 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1 @@
benjamyn.love

View File

@ -0,0 +1,37 @@
#!/bin/bash
# Hopefully I can get this to work, it should be able to helps with troubleshooting email issues
MAILLOGFILE="/var/log/exim/main.log"
LOCALDOMAINFILE="localdomains"
EMAILADDR=$1
SEARCHTERM=$EMAILADDR
LOCAL=false
isDomainLocal() {
grep $1 $LOCALDOMAINFILE > /dev/null
if [[ $? == 0 ]]
then
TMPVAL=`echo $EMAILADDR | cut -d '@' -f 1`
SEARCHTERM=$TMPVAL
echo "$TMPVAL"
fi
}
DOMAIN=`echo $EMAILADDR | cut -d '@' -f 2`
isDomainLocal $DOMAIN
echo "$SEARCHTERM"
echo "---------Email Throughput for $1--------"
echo "Emails Sent by: `exigrep $SEARCHTERM $MAILLOGFILE | grep "<= $SEARCHTERM" | wc -l`"
echo "Emails Sent to: `exigrep $SEARCHTERM $MAILLOGFILE | grep "=> $SEARCHTERM" | wc -l`"
echo "Total emails with $1: `exigrep $SEARCHTERM $MAILLOGFILE | grep -i 'completed' | wc -l`"
echo ""
echo "--------Email ID's for sent/received--------"
echo "Sent By ID's:"
echo "`exigrep $SEARCHTERM $MAILLOGFILE | grep "<= $SEARCHTERM" | awk '{print $3 " From " $6 ":" $7}' `"
echo "Sent To ID's:"
echo "`exigrep $SEARCHTERM $MAILLOGFILE | grep "=> $SEARCHTERM" | awk '{print $3" To " $8 ":" $9}' `"
echo ""
echo "-------Emails Send from Hosts-------"