root/alternc-awstats/tags/0.5.1/alternc-awstats

Revision 1867, 1.8 kB (checked in by benjamin, 1 year ago)

adding logresolvemerge.pl since awstats one is buggy ...

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1 #!/bin/sh
2
3 # Appelé seul, lance les stats AWStats du jour.
4 # Appelé avec "all" lance les stats avec tous les fichiers .gz situés dans /var/log/apache
5 # Appelé avec un nom de domaine en paramètre, rescanne tous les fichiers .gz pour ce domaine uniquement.
6
7
8 . /etc/alternc/local.sh
9
10 # This file specify a different ACCESSLOG when there is apachemerge in the server.
11 if [ -e /etc/alternc/webalizer.conf ]
12 then
13     . /etc/alternc/webalizer.conf
14 fi
15
16 # Regenerate the awstat etc cache files :
17 if [ -x ./awstats.cache.php ]
18 then
19     ./awstats.cache.php
20 fi
21
22 if [ -z "$MYSQL_HOST" ]
23 then
24     MYSQL_HOST="localhost"
25 fi
26
27 CACHEDIR="/var/cache/awstats" # Dans la sarge par defaut les données awstats sont stockées dans /var/lib/awstats ...
28 mkdir -p $CACHEDIR
29
30
31
32 function dostatgz {
33     read DOM
34     while [ "$DOM" ]
35     do
36       echo "processing $DOM (for access files in $ACCESSLOGPATH/access.log* )"
37       /usr/lib/cgi-bin/awstats.pl -config=$DOM -update -LogFile="/usr/lib/alternc/logresolvemerge.pl $ACCESSLOGPATH/access.log* |"
38       read DOM
39     done
40 }
41
42 function dostat {
43     read DOM
44     while [ "$DOM" ]
45     do   
46       echo "processing $DOM"
47       /usr/lib/cgi-bin/awstats.pl -config=$DOM  -LogFile="$ACCESSLOG"
48       read DOM
49     done
50 }
51
52 if [ -z "$1" ]
53     then
54     if [ -z "$ACCESSLOG" ]
55         then
56         ACCESSLOG="/usr/lib/alternc/logresolvemerge.pl /var/log/apache/access.log /var/log/apache/access.log.1 | "
57     fi
58     mysql -h"$MYSQL_HOST" -p"$MYSQL_PASS" -u"$MYSQL_USER" "$MYSQL_DATABASE" -B -e "SELECT hostname FROM aws" |grep -v "^hostname" | dostat
59 else
60     ACCESSLOGPATH="/var/log/apache"
61     if [ "$1" = "all" ]
62         then
63         mysql -h"$MYSQL_HOST" -p"$MYSQL_PASS" -u"$MYSQL_USER" "$MYSQL_DATABASE" -B -e "SELECT hostname FROM aws" |grep -v "^hostname" | dostatgz
64     else
65         echo "$1" | dostatgz
66     fi
67 fi
68
Note: See TracBrowser for help on using the browser.