#!/bin/sh
#CREDITS
#======== 
#Kimmie and Rick Dicaire    
#Change user@isp.com to your email address

prog () {
echo "$DATE" >> Web-report-$FILE1.txt
/usr/local/pgsql/bin/psql -x -o Web-report-$FILE1.txt web -c "select * from hits where date='NOW()' order by time desc;"
echo "KR EZ Web Tracker Log By Kimmie Dicaire" >> report-$FILE1.txt
mail -s "report-$FILE1.txt" user@isp.com  < Web-report-$FILE1.txt
}
DATE=`date`
DATE1=`date "+%b %d"` 
DATE2=`echo $DATE1|sed s/0/" "/g`
FILE1=`date "+%b-%d-%Y"`
if [ "`echo "$DATE1"|cut -b5`" = "0" ];
then 
DATE2=`echo $DATE1|sed s/0/" "/g`
prog
else 
DATE2=`date "+%b %d"`
prog
fi

