為了很快的從Apache伺服器的存取記錄檔,瞭解哪些是前二十名被瀏覽的網頁,以 下是一段簡單的shell script供各位參考。
#!/bin/bash
export PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin"
top()
{
for pages in `cut -d' ' -f7 /var/log/httpd/access_log | egrep ".*htm[l]*$|.*index\.php"` do echo "http://www.geego.com.tw$pages" done
}
if `top | sort | uniq -c | sort -nr | head -20 | mail -s 'The top 20 pages' webmaster@geego.com.tw` ; then echo "Top 20 pages sent successfully!"
fi
#!/bin/bash
export PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin"
top()
{
for pages in `cut -d' ' -f7 /var/log/httpd/access_log | egrep ".*htm[l]*$|.*index\.php"` do echo "http://www.geego.com.tw$pages" done
}
if `top | sort | uniq -c | sort -nr | head -20 | mail -s 'The top 20 pages' webmaster@geego.com.tw` ; then echo "Top 20 pages sent successfully!"
fi
沒有留言:
張貼留言