View Single Post
  #1 (permalink)  
Old 18-10-2008, 22:09
eUKMatthew eUKMatthew is offline
System Administrator(eUKhost.com)
 
Join Date: Aug 2007
Posts: 97
Default googlebot IP block check script

Sometimes googlebot IP’s get blocked in CSF / APF firewall and bots are not able to visit your websites not can google list your pages in search result.

Google never makes their IP addresses list open as the IP addresses keep on changing. The only way to find out googlebot IP is by checking Reverse DNS.

following is a shell script to keep an eye on blocked googlebot IP’s.

HTML Code:
     #!/bin/bash

    awk ‘{print $1}’ /etc/csf/csf.deny | grep -v ‘#’ > /tmp/deny_list.txt

    for i in `cat /tmp/deny_list.txt`
    do
    host $i | grep googlebot

    if [ $? -eq 0 ]
    then
    echo $i >> /tmp/googlebot-ip-list.txt
    fi

    done

    if [ -f /tmp/googlebot-ip-list.txt ]
    then

    echo “Check the reverse DNS before unblocking above IP” >> /tmp/googlebot-ip-list.txt
    mail -s “Googlebot IP is blocked on `hostname`” your_email@address < /tmp/googlebot-ip-list.txt

    fi

    rm -f /tmp/googlebot-ip-list.txt
    rm -f /tmp/deny_list.txt
create a file in /etc/cron.hourly/ to check googlebot IP every hour or in /etc/cron.daily/ to check on daily basis as per your requirement.

chmod 755 / 750 to execute it.

for apf firewall replace the code

HTML Code:
awk ‘{print $1}’ /etc/csf/csf.deny | grep -v ‘#’ > /tmp/deny_list.txt
with

HTML Code:
awk ‘{print $1}’ /etc/apf/deny_hosts.rules | grep -v ‘#’ > /tmp/deny_list.txt
Thats it

Matthew
UK Web Hosting - Cheap Windows Linux cPanel Shared Reseller Web Hosting in UK
Reply With Quote