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

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>
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值