#! /bin/bash
# afrihost - show bounces for a domain.


usage () {
echo "Options are:
1. Show bounces from current exim_mainlog
 /usr/local/afribin/get_bounces_domain.sh domainname
2. show counces from current and all archived maillogs 
 /usr/local/afribin/get_bounces_domain.sh domainname --archived
                      "
}

if ! [ "$1" ] ; then
                usage
                exit 1
        elif    [ "$1" == "--help" ] ; then
                usage
        elif    [ "$1" == "--revert" ] ; then
                revert_upgrade_attempt
fi

if grep $1 /etc/trueuserdomains ; then 
        grep  $1 /var/log/exim_mainlog | grep  "<>" |  grep -o "......-......-.." | sort | uniq   | grep ^1 | while read pmail ; do echo -e  "\n======= $pmail ======\n $(zgrep $pmail /var/log/exim_mainlog) \n======= $pmail end ======\n" ;done  | geoip
fi
