root/alternc-awstats/trunk/alternc-awstats

Revision 2163, 1.8 kB (checked in by engelaere, 6 months ago)

Utilisation du fichier /etc/alternc/my.cnf

  • 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 # This file specify a different ACCESSLOG when there is apachemerge in the server.
8 if [ -e /etc/alternc/webalizer.conf ]
9 then
10     . /etc/alternc/webalizer.conf
11 fi
12
13 # Regenerate the awstat etc cache files :
14 if [ -x ./awstats.cache.php ]
15 then
16     ./awstats.cache.php
17 fi
18
19 if [ -z "$MYSQL_HOST" ]
20 then
21     MYSQL_HOST="localhost"
22 fi
23
24 CACHEDIR="/var/cache/awstats" # Dans la sarge par defaut les données awstats sont stockées dans /var/lib/awstats ...
25 mkdir -p $CACHEDIR
26
27 if [ -x /usr/sbin/apache ]; then
28     LOGAPACHE="/var/log/apache/access.log"
29 fi
30
31 if [ -x /usr/sbin/apache2 ]; then
32     LOGAPACHE="/var/log/apache2/access.log"
33 fi
34
35 function dostatgz {
36     read DOM
37     while [ "$DOM" ]
38     do
39       echo "processing $DOM (for access files in $LOGAPACHE/access.log* )"
40       /usr/lib/cgi-bin/awstats.pl -config=$DOM -update -LogFile="/usr/lib/alternc/logresolvemerge.pl $LOGAPACHE/access.log* |"
41       read DOM
42     done
43 }
44
45 function dostat {
46     read DOM
47     while [ "$DOM" ]
48     do
49       echo "processing $DOM"
50       /usr/lib/cgi-bin/awstats.pl -config=$DOM  -LogFile="$ACCESSLOG"
51       read DOM
52     done
53 }
54
55 if [ -z "$1" ]
56     then
57     if [ -z "$ACCESSLOG" ]
58         then
59         ACCESSLOG="/usr/lib/alternc/logresolvemerge.pl $LOGAPACHE $LOGAPACHE.1 | "
60     fi
61     mysql --defaults-file=/etc/alternc/my.cnf -B -e "SELECT hostname FROM aws" |grep -v "^hostname" | dostat
62 else
63     if [ "$1" = "all" ]
64         then
65         mysql --defaults-file=/etc/alternc/my.cnf -B -e "SELECT hostname FROM aws" |grep -v "^hostname" | dostatgz
66     else
67         echo "$1" | dostatgz
68     fi
69 fi
70
Note: See TracBrowser for help on using the browser.