定时获取robots日志脚本
#!/bin/sh
ip=`/sbin/ifconfig | grep inet | grep -v inet6 | grep -v 127.0.0.1 | cut -d “:” -f 2 | cut -d ” ” -f 1 | head -1`
mydate=`date +%Y%m%d%H%M%S`
dir=’/home/username/logs’
mkdir $dir
cat /var/log/apache2/access.log | grep Googlebot>$dir/google.$ip.$mydate.log
chown usrname:username -R $dir
#注意,ifconfig一定要用全路径,否则不能在crontab中运行。