Posted by: SiiN on: November 24, 2007
#!/bin/bash
hostname=`/bin/hostname`
MAIL_BODY=/tmp/googleblock.txt
#Give the email address(es) to which the script will have to send the alerts
MAIL_TO=some_addr@some_domain.com
send_mail()
{
cat $MAIL_BODY|mail -s ” Googlebot IP blocked on $hostname” $MAIL_TO
rm -f $MAIL_BODY
}
for i in `cat /etc/apf/deny_hosts.rules | grep -v “#” `
do
host $i | grep googlebot
if [ $? -eq 0 ]
then
echo $i >> $MAIL_BODY
fi
done
if [ [...]