go to  ForumEasy.com   
JavaPro
Home » Archive » Message


[Email To Friend][View in Live Context][prev topic « prev post | next post » next topic]
  Update Statistics
 
Subject: Update Statistics
Author: AwsEC2
In response to: Configure AWStats for each virtul host
Posted on: 09/04/2012 12:15:09 AM

/usr/local/awstats/tools/awstats_updateall.pl now 
  -confdir="/etc/awstats/" 
  -awstatsprog="/usr/local/awstats/wwwroot/cgi-bin/awstats.pl"


If you want to periodically run the above update, you can put the script into /ect/cron.d as follows:

List of scripts:
$ ls -l /etc/cron.d
-rw-r--r--  1 root root  47 Jul  7  2008 awstatcronsetup
-rw-r--r--  1 root root 151 Sep  6 23:55 awstats


AWStats cron setup:
$ cat /etc/cron.d/awstatcronsetup

55 23 * * * root /usr/share/awstats/cronsetup



AWStats script setup:
$ cat /usr/share/awstats/cronsetup

#!/bin/bash

hour=`echo $[$RANDOM % 24]`

if [ $hour -gt 9 ]; then
	echo "00 $hour * * * root /usr/share/awstats/awstats_updateall.pl now 
    -awstatsprog=/var/www/cgi-bin/awstats/awstats.pl 
    -configdir=/etc/awstats/ >/dev/null 2>&1" >/etc/cron.d/awstats
else 
	echo "00 0$hour * * * root /usr/share/awstats/awstats_updateall.pl now 
    -awstatsprog=/var/www/cgi-bin/awstats/awstats.pl 
    -configdir=/etc/awstats/ >/dev/null 2>&1" >/etc/cron.d/awstats
fi

/sbin/service crond restart >/dev/null 2>&1



AWStats update cron script:
$ cat /etc/cron.d/awstats

00 18 * * * root /usr/share/awstats/awstats_updateall.pl now 
-awstatsprog=/var/www/cgi-bin/awstats/awstats.pl 
-configdir=/etc/awstats/ >/dev/null 2>&1




Details can be found here:
http://forumeasy.com/forums/thread.jsp?tid=134670661180&fid=javaprof12

 

> On 09/03/2012 11:56:42 PM AwsEC2 wrote:

# cp /usr/local/awstats/wwwroot/cgi-bin/awstats.model.conf /etc/awstats/awstats.example1.com.conf
# vi /etc/awstats/awstats.example1.com.conf


Make sure the following:
LogFile="/home/ec2-user/example1.com/access_log"
LogType=W
LogFormat=1
SiteDomain="example1.com"
DirData="/home/ec2-user/example1.com/awstats"
DirCgi="/cgi-bin/awstats"
DirIcons="/awstats/icon"
AllowToUpdateStatsFromBrowser=1


Here DirData is used for store updated statistics results. If it does not exist, create one first. Also, as the statistics is allowed to be updated from browser (AllowToUpdateStatsFromBrowser=1), DirData may have to be set to allow write permission for nobody (apache).

# mkdir /home/ec2-user/example1.com/awstats
# chmod 777 /home/ec2-user/example1.com/awstats






References:

 


 
Powered by ForumEasy © 2002-2022, All Rights Reserved. | Privacy Policy | Terms of Use
 
Get your own forum today. It's easy and free.