sandvold.sh

 


echo " <html> " > /var/www/wendy/sandvold/usage.html
echo " <head> " >> /var/www/wendy/sandvold/usage.html
echo " <META content=text/css http-equiv=Content-Style-Type>" >> /var/www/wendy/sandvold/usage.html
echo " <LINK href=\"white.css\" rel=\"stylesheet\" type=\"text/css\">" >> /var/www/wendy/sandvold/usage.html
echo " <title>Sandvold Usage Statistics</title>" >> /var/www/wendy/sandvold/usage.html
echo " </head> " >> /var/www/wendy/sandvold/usage.html
echo " <body> " >> /var/www/wendy/sandvold/usage.html
echo " <blockquote><blockquote><font class=grey2> " >> /var/www/wendy/sandvold/usage.html
echo " <p>&nbsp;</p> " >> /var/www/wendy/sandvold/usage.html
echo " <h2>Sandvold Usage Statistics</h2>" >> /var/www/wendy/sandvold/usage.html

echo " <p>&nbsp;</p> " >> /var/www/wendy/sandvold/usage.html
echo "  " >> /var/www/wendy/sandvold/usage.html

echo " <p>&nbsp;</p> " >> /var/www/wendy/sandvold/usage.html
echo " <h3>Hits</h3>" >> /var/www/wendy/sandvold/usage.html

echo "<table cellpadding=10 border=1>  " >> /var/www/wendy/sandvold/usage.html
echo "<tr> " >> /var/www/wendy/sandvold/usage.html
   echo "    <th align=left>Date" >> /var/www/wendy/sandvold/usage.html
   echo "    <th align=left>Total Hits" >> /var/www/wendy/sandvold/usage.html
   echo "    <th align=left>Distinct Users" >> /var/www/wendy/sandvold/usage.html

for i in `cut -d" " -f4 /etc/httpd/logs/access_log | cut -d: -f1 | sed "s/\[//g"  | sort | uniq`
do
   echo " " >> /var/www/wendy/sandvold/usage.html
   x=`grep $i /etc/httpd/logs/access_log | grep -v 192.168.0 | grep \/sandvold | cut -d" " -f1 | sort | uniq | wc -l`
   y=`grep $i /etc/httpd/logs/access_log | grep -v 192.168.0 | grep \/sandvold | cut -d" " -f1 | wc -l`
   echo "<tr> " >> /var/www/wendy/sandvold/usage.html
   echo "    <td>$i " >> /var/www/wendy/sandvold/usage.html
   echo "    <td align=right>$y " >> /var/www/wendy/sandvold/usage.html
   echo "    <td align=right>$x " >> /var/www/wendy/sandvold/usage.html
   echo " " >> /var/www/wendy/sandvold/usage.html
done
echo "</table>" >> /var/www/wendy/sandvold/usage.html


#echo " <p>&nbsp;</p> " >> /var/www/wendy/sandvold/usage.html
#echo " <h3>Visitors</h3>" >> /var/www/wendy/sandvold/usage.html
#echo "  " >> /var/www/wendy/sandvold/usage.html
#
#for i in `cut -d" " -f4 /etc/httpd/logs/access_log | cut -d: -f1 | sed "s/\[//g"  | sort | uniq`
#do
#   echo " " >> /var/www/wendy/sandvold/usage.html
#   echo " <ol>" >> /var/www/wendy/sandvold/usage.html
#   for x in `grep $i /etc/httpd/logs/access_log | grep -v 192.168.0 | grep \/sandvold | cut -d" " -f1 | sort | uniq` 
#   do
#       echo " <br>" >> /var/www/wendy/sandvold/usage.html
#       z=`host $x  | grep -v "not found" | cut -d" " -f5 | cut -d. -f2-100 | sed "s/\.$//"`
#       if [ "$z" = "" ]
#       then
#           echo "<li><a href=\"http://$x\">$x</a>" >> /var/www/wendy/sandvold/usage.html
#       else
#           echo "<li><a href=\"http://www.${z}\">$z</a>" >> /var/www/wendy/sandvold/usage.html
#       fi
#  
#
#   done
#   echo " </ol>" >> /var/www/wendy/sandvold/usage.html
#    
#   
#done


echo "</body>" >> /var/www/wendy/sandvold/usage.html
echo "</html>" >> /var/www/wendy/sandvold/usage.html