Automail - Generate Awstats Page and send it out

#!/bin/bash
#
# Automated email system generated by statis page by awstats and then mail to the host user
# Generated at 050405 Jeffrey
# Change to using $1 and $2 rather than change the variable

if [ -z "$1" ] || [ -z "$2" ]; then
echo "usage: sh $0 mailto awstatsconf"
exit
fi


MAILTO=$1
AWSTATSCONF=$2

mkdir /tmp/awstats
cd /tmp/awstats
nohup /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=$AWSTATSCONF > /dev/null &
/usr/bin/wget -q --no-parent -r http://192.168.10.1/awstats/awstats.pl?config=$AWSTATSCONF
/bin/mv 192.168.10.1/awstats/awstats.pl\?config\=$AWSTATSCONF ./$AWSTATSCONF.html
/bin/echo "Self Generated Mail from jktn.com" > /tmp/awstats/greeting
/usr/bin/mutt -s "Awstats at $(date +%y%m%d)" -a /tmp/awstats/$AWSTATSCONF.html $MAILTO < /tmp/awstats/greeting
/bin/rm -rf /tmp/awstats

Comments

Popular Posts