您的位置:首页 > 其它

解决awstats跨月分析日志问题及其他改进

2010-07-02 17:51 435 查看
1。生成静态统计页面的脚本,每天执行一次

# more autolog
#!/bin/bash
pl=/usr/lib/cgi-bin/awstats.pl
static=/usr/lib/cgi-bin/awstats_buildstaticpages.pl
datadir=/data/webroot/awstats/
htmldir=/data/webroot/awstats/
datatime=$(date +%Y%m)
firstday=$(date +%d)
lastmonth=$(date +%m --date='1 days ago')
lastmonthyear=$(date +%Y%m --date='1 days ago')
domain1=www.china.com
domain2=cin.china.com
domain3=spo.china.com

echo $firstday
echo $lastmonth
echo $lastmonthyear
#创建当月目录
if [ -d $datadir$datatime ]; then
echo "$datadir$datatime目录存在 ."
else
mkdir $datadir$datatime
fi
#判断是否是月初第一天
if [ $firstday = "01" ]; then
echo "月初第一天 ."
#生成上月的静态统计页面
for domain in $domain1 $domain2 $domain3;do
$static -config=$domain -update -month=$lastmonth -year=2010 -awstatsprog=$pl -dir=$datadir$lastmonthyear
done
else
if [ $firstday = "02" ]; then
echo "月初第二天 ."
#生成当月静态统计页面并且更新web统计页面左侧导航链接
for domain in $domain1 $domain2 $domain3;do
$static -config=$domain -update -awstatsprog=$pl -dir=$datadir$datatime
done
echo "<a href=/"$datatime/awstats.w.china.com.html/"target=main><font color=#0000ff>${datatime}wo</font></
a>
<a href=/"$datatime/awstats.cin.china.com.html/"target=main><font color=#0000ff>${datatime}movie</font></a>
<a href=/"$datatime/awstats.spt.china.com.html/"target=main><font color=#0000ff>${datatime}sport</font></a>" >$h
tmldir/tmp.html
cat $htmldir/indexleft.html >> $htmldir/tmp.html
mv $htmldir/tmp.html $htmldir/indexleft.html
else
echo "不是月初前2天 ."
#生成当月静态统计页面
for domain in $domain1 $domain2 $domain3;do
$static -config=$domain -update -awstatsprog=$pl -dir=$datadir$datatime
done
fi
fi







2。分析页面使用frameset技术的导航

# more index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html>
<head>
<title></title>
</head>
<!-- <frameset rows="60, *"> -->
<frameset cols="11%, *">
<frame src="indexleft.html" />
<frame name="main" src="201007/awstats.www.china.com.html" />
<noframes>
<body>
</body>
</noframes>
</frameset>
</html>





3。导航页

# more indexleft.html
<a href="201007/awstats.www.china.com.html"target=main><font color=#0000ff>201007wo</font></a>
<a href="201007/awstats.cin.china.com.html"target=main><font color=#0000ff>201007movie</font></a>
<a href="201007/awstats.spt.china.com.html"target=main><font color=#0000ff>201007sport</font></a>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐