定时执行以下这两句话就可以了(分别是按月和按天)
perl -w /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=www.XXXX.com -update -configdir="/etc/awstats/" -DatabaseBreak=day &
perl -w /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=www.XXXX.com -update -configdir="/etc/awstats/" -DatabaseBreak=month &
访问某日的统计页面的话,在url后面加上&databasebreak=day&day=1&month=3即可,如:3月1日:
config=www.XXXX.com&databasebreak=day&day=1&month=3
 
 
上网找了一个日历php,把日期和月份加上超链接就成了以下两个日历的php,放在apache下。
# cat lastmonth.php
<?
/*******************************
* 用来判断是否闰年的函数*
* 可以根据更复杂的算法改进*
*******************************/
function leap_year($year)
{
if($year% 4 == 0) // basic rule
{
 return true; // is leap year
}
 else
 {
return false;
 }
}
/*******************************
* 对一些变量进行赋值操作*
* 特别注意对二月份的赋值*
*******************************/
function setup()
 {
 global $mon_num;
 $mon_num=array(31,28,31,30,31,30,31,31,30,31,30,31);
 global $mon_name;
 $mon_name=array("一","二","三","四",
"五","六","七","八",
"九","十","十一","十二");
 if (leap_year($firstday[year])) // basic rule
{
$mon_num[1]=28; // is leap year
}
 else
 {
 $mon_num[1]=28;
 }
 }
/*******************************
* 显示表格中的一格*
* 显示的内容和颜色可变*
*******************************/
function showline($content,$show_color,$urlmark)
{
 $begin_mark = "<TD WIDTH=60 HEIGHT=25>";
$begin_mark =$begin_mark."<FONT COLOR=$show_color>";
$begin_mark =$begin_mark."<a href=$urlmark>";
$end_mark = "</a></FONT></TD>";
 echo $begin_mark.$content.$end_mark ;
}
?>
<!--日历程序的正式开始-->
<html>
<head>
<title>
上月awstats统计
</title>
<meta http-equiv=content-type content="text/html; charset=gb2312">
<head>
<body bgcolor="WhiteSmoke" >
<table width=100%>
<tr>
<td>
<FONT COLOR=blue SIZE=8 >上月nginx日志分析</FONT>
</td>
<td>
<a href=./thismonth.php>本月</a>
</td>
</tr>
<?
 //获得当前的日期
 $firstday= getdate(mktime(0,0,0,date("m")-1,1,date("Y")));
// $currentday=  getdate(mktime(0,0,0,date("m"),date("d"),date("Y")));
 setup();
//显示表格的名称
echo "<CENTER>";
echo "<TABLE BORDER=2CELLSPACING=4>";
echo "<TH COLSPAN=7 HEIGHT=50>";
echo "<FONT COLOR=red SIZE=3 >";
echo "<a href=http://192.168.1.115/awstats/awstats.pl?config=www.XXXX.com&databasebreak=month&month=$firstday[mon]>";
echo "$firstday[year]年  ".$mon_name[$firstday[mon]-1]."月(按月统计)";
echo "</a>";
echo "</FONT>";
echo "</TH>";
//表头
$weekDay[0] = "日";
$weekDay[1] = "一";
$weekDay[2] = "二";
$weekDay[3] = "三";
$weekDay[4] = "四";
$weekDay[5] = "五";
$weekDay[6] = "六";
echo '<TR ALIGN = "center" VALIGN="center">';
//显示表格的第一行
for ($dayNum = 0; $dayNum < 7; ++$dayNum) {
showline($weekDay[$dayNum],"red");
}
echo"</TR>";
 $toweek=$firstday[wday];//本月的第一天是星期几
 $lastday=$mon_num[$firstday[mon]-1];//本月的最后一天是星期几
 $day_count = 1;//当前应该显示的天数
$up_to_firstday = 1;//是否显示到本月的第一天
for ($row = 0; $row <= ($lastday+$toweek-1)/7; ++$row)//本月有几个星期
{echo "<TR ALIGN=center VALIGN=center>";
for ($col=1; $col<=7; ++$col)
{
//在第一天前面显示的都是"空"
if (($up_to_firstday <= $toweek) ||($day_count>$lastday))
{
echo "<TD> </TD>";
$up_to_firstday++;
}
else
{
//显示本月中的某一天
//<a href=" $day_counthttp://192.168.1.115/awstats/awstats.pl?config=www. XXXX.com&databasebreak=day&day=$day_count">$day_count</a>;
 showline($day_count,"blue"," http://192.168.1.115/awstats/awstats.pl?config=www.XXXX.com&databasebreak=day&day=$day_count&month=$firstday[mon]");
$day_count++;
 }
}
echo "</TR>";
}
echo "</TABLE>";
echo "</CENTER>";
?>
</body>
</html>
 
# cat thismonth.php
<?
/*******************************
* 用来判断是否闰年的函数*
* 可以根据更复杂的算法改进*
*******************************/
function leap_year($year)
{
if($year% 4 == 0) // basic rule
{
 return true; // is leap year
}
 else
 {
return false;
 }
}
/*******************************
* 对一些变量进行赋值操作*
* 特别注意对二月份的赋值*
*******************************/
function setup()
 {
 global $mon_num;
 $mon_num=array(31,30,31,30,31,30,31,31,30,31,30,31);
 global $mon_name;
 $mon_name=array("一","二","三","四",
"五","六","七","八",
"九","十","十一","十二");
 if (leap_year($firstday[year])) // basic rule
{
$mon_num[1]=29; // is leap year
}
 else
 {
 $mon_num[1]=28;
 }
 }
/*******************************
* 显示表格中的一格*
* 显示的内容和颜色可变*
*******************************/
function showline($content,$show_color,$urlmark)
{
 $begin_mark = "<TD WIDTH=60 HEIGHT=25>";
$begin_mark =$begin_mark."<FONT COLOR=$show_color>";
$begin_mark =$begin_mark."<a href=$urlmark>";
$end_mark = "</a></FONT></TD>";
 echo $begin_mark.$content.$end_mark ;
}
?>
<!--日历程序的正式开始-->
<html>
<head>
<title>
本月awstats统计
</title>
<meta http-equiv=content-type content="text/html; charset=gb2312">
<head>
<body bgcolor="WhiteSmoke" >
<table width=100%>
<tr>
<td>
<FONT COLOR=blue SIZE=8 >本月nginx日志分析</FONT>
</td>
<td>
<a href=./lastmonth.php>上月</a>
</td>
</tr>
<?
 //获得当前的日期
 $firstday= getdate(mktime(0,0,0,date("m"),1,date("Y")));
// $currentday=  getdate(mktime(0,0,0,date("m"),date("d"),date("Y")));
 setup();
//显示表格的名称
echo "<CENTER>";
echo "<TABLE BORDER=2CELLSPACING=4>";
echo "<TH COLSPAN=7 HEIGHT=50>";
echo "<FONT COLOR=red SIZE=3 >";
echo "<a href=http://192.168.1.115/awstats/awstats.pl?config=www.XXXX.com&databasebreak=month&month=$firstday[mon]>";
echo "$firstday[year]年  ".$mon_name[$firstday[mon]-1]."月(按月统计)";
echo "</a>";
echo "</FONT>";
echo "</TH>";
//表头
$weekDay[0] = "日";
$weekDay[1] = "一";
$weekDay[2] = "二";
$weekDay[3] = "三";
$weekDay[4] = "四";
$weekDay[5] = "五";
$weekDay[6] = "六";
echo '<TR ALIGN = "center" VALIGN="center">';
//显示表格的第一行
for ($dayNum = 0; $dayNum < 7; ++$dayNum) {
showline($weekDay[$dayNum],"red");
}
echo"</TR>";
 $toweek=$firstday[wday];//本月的第一天是星期几
 $lastday=$mon_num[$firstday[mon]-1];//本月的最后一天是星期几
 $day_count = 1;//当前应该显示的天数
$up_to_firstday = 1;//是否显示到本月的第一天
for ($row = 0; $row <= ($lastday+$toweek-1)/7; ++$row)//本月有几个星期
{echo "<TR ALIGN=center VALIGN=center>";
for ($col=1; $col<=7; ++$col)
{
//在第一天前面显示的都是"空"
if (($up_to_firstday <= $toweek) ||($day_count>$lastday))
{
echo "<TD> </TD>";
$up_to_firstday++;
}
else
{
//显示本月中的某一天
//<a href=" $day_counthttp://192.168.1.115/awstats/awstats.pl?config=www. XXXX.com&databasebreak=day&day=$day_count">$day_count</a>;
 showline($day_count,"blue"," http://192.168.1.115/awstats/awstats.pl?config=www.XXXX.com&databasebreak=day&day=$day_count&month=$firstday[mon]");
$day_count++;
 }
}
echo "</TR>";
}
echo "</TABLE>";
echo "</CENTER>";
?>
</body>
</html>