source: trunk/alternc-awstats @ 1035

Revision 1035, 1.1 KB checked in by anonymous, 9 years ago (diff)

modification diverses dans bureau
modification du fichier de menu
ecriture du script alternc-awstats

  • 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. /etc/alternc/local.sh
3
4#if [ -e /etc/alternc/webalizer.conf ]
5#then
6#    . /etc/alternc/webalizer.conf
7#fi
8
9if [ -z "$ACCESSLOG" ] 
10then
11    ACCESSLOG="/var/log/apache/access.log.1"
12fi
13
14if [ -z "$MYSQL_HOST" ] 
15then
16    MYSQL_HOST="localhost"
17fi
18
19CACHEDIR="/var/cache/alternc-awstats"
20TMPDNS=`mktemp -p /tmp`
21TMPLOG=`mktemp -p /tmp`
22mkdir -p $CACHEDIR
23trap cleanup 1 2 15
24
25function cleanup {
26    rm -f $TMPDNS
27    rm -f $TMPLOG
28    rm -rf $CACHEDIR/*
29}
30
31function dostat {
32    read DOM
33    while [ "$DOM" ]
34    do   
35      #export LC_ALL="$LANG"
36      #export LC_MESSAGES="$LANG"
37      #export LANG
38      echo "processing $DOM"
39      # first run: resolve IPs in cache
40      #grep -h " $DOM$" $ACCESSLOG | /usr/bin/webalizer -c $CACHEDIR/$DOM.conf -N 5 -D $TMPDNS - &>/dev/null
41      # second run: process the stats
42      /usr/lib/cgi-bin/awstats.pl -config=$DOM 
43      read DOM
44    done
45}
46
47# Clear the cache dir
48rm -rf $CACHEDIR/*
49# Fill the cache dir
50/usr/lib/alternc/awstats.cache.php
51
52# Launch the stat
53mysql -h"$MYSQL_HOST" -p"$MYSQL_PASS" -u"$MYSQL_USER" "$MYSQL_DATABASE" -B -e "SELECT hostname FROM aws" |grep -v "^hostname" | dostat
54
55cleanup
Note: See TracBrowser for help on using the repository browser.