| Revision 1037,
1.2 KB
checked in by anonymous, 9 years ago
(diff) |
|
Suppression des inutiles
Corrections diverses dans le script (on n'EFFACE PAS le cache ...)
|
-
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 | |
|---|
| 9 | if [ -z "$ACCESSLOG" ] |
|---|
| 10 | then |
|---|
| 11 | ACCESSLOG="/var/log/apache/access.log.1" |
|---|
| 12 | fi |
|---|
| 13 | |
|---|
| 14 | if [ -z "$MYSQL_HOST" ] |
|---|
| 15 | then |
|---|
| 16 | MYSQL_HOST="localhost" |
|---|
| 17 | fi |
|---|
| 18 | |
|---|
| 19 | CACHEDIR="/var/cache/awstats" |
|---|
| 20 | TMPDNS=`mktemp -p /tmp` |
|---|
| 21 | TMPLOG=`mktemp -p /tmp` |
|---|
| 22 | mkdir -p $CACHEDIR |
|---|
| 23 | trap cleanup 1 2 15 |
|---|
| 24 | |
|---|
| 25 | function cleanup { |
|---|
| 26 | rm -f $TMPDNS |
|---|
| 27 | rm -f $TMPLOG |
|---|
| 28 | # rm -rf $CACHEDIR/* |
|---|
| 29 | } |
|---|
| 30 | |
|---|
| 31 | function 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 |
|---|
| 48 | # DONT do it ! it looses all previously computed data ! |
|---|
| 49 | #rm -rf $CACHEDIR/* |
|---|
| 50 | # Fill the cache dir (/etc dir) |
|---|
| 51 | # not required: m_aws.php build it properly |
|---|
| 52 | # /usr/lib/alternc/awstats.cache.php |
|---|
| 53 | |
|---|
| 54 | # Launch the stat |
|---|
| 55 | mysql -h"$MYSQL_HOST" -p"$MYSQL_PASS" -u"$MYSQL_USER" "$MYSQL_DATABASE" -B -e "SELECT hostname FROM aws" |grep -v "^hostname" | dostat |
|---|
| 56 | |
|---|
| 57 | cleanup |
|---|
Note: See
TracBrowser
for help on using the repository browser.