Forum Moderators: DixonJones
Thanks!
The script (googlebot_totals.sh user=root, perm=700) is as follows:
#!/bin/bash
LOG_FILE="/var/log/httpd/$1/access_log"
SED_URL="http:\/\/$1"
echo "GOOGLEBOT REPORT FOR $2/$3/$4"
echo "UNIQUE FILES VIEWED"
grep $2/$3/$4.*googlebot $LOG_FILE ¦ sed -e 's/^.*GET /'`echo ${SED_URL}`'/' -e 's/HTTP.*$//' ¦ sort ¦ uniq
echo -n "TOTAL HITS:"
grep $2/$3/$4.*googlebot $LOG_FILE ¦ uniq ¦ wc -l
echo -n "TOTAL UNIQUE HITS:"
grep $2/$3/$4.*googlebot $LOG_FILE ¦ sed -e 's/^.*GET//' -e 's/200 [0-9]*//' ¦ sort ¦ uniq ¦ wc -l
googlebot_cron.sh www.site.tld `date +"%d %b %Y"` googlebot_cron.sh www.site.tld ".." `date +"%b %Y"` the cronjob should be something like
[code]59 23 * * * /path/to/googlebot_cron.sh www.site.tld `date +"%d %b %Y"`[code]
The use of date (combined with log-rotation) give you a real narrow window for accurate results.
Licensing Information:
Provided as is with no warranty. Commercial modifications and redistribution explicitly forbidden, please sticky me if you wish to commercially use or redistribute this code and I will properly release it under GPL.