awstats batch statistic builder

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh
AWDIR="/web/awstats"
AWSTATS="$AWDIR/cgi-bin/awstats.pl"
REPORTS="alldomains allhosts lasthosts unknownip allemails lastemails allemailr lastemailr alllogins lastlogins allrobots lastrobots urldetail urlentry urlexit osdetail browserdetail unknownbrowser unknownos refererse refererpages keyphrases keywords errors404"
SITES="somedomain.com anotherdomain.com foobar.com"
INDEX_PAGE="$AWDIR/data/index.html"
custom_report() {
SITE=$1
REPORT=$2
$AWSTATS -config=$SITE -output=$REPORT -staticlinks > "$AWDIR/data/awstats.$SITE.$REPORT.html"
}
# At first parse all logs
for SITE in $SITES; do
$AWSTATS -config=$SITE
done
echo "" > $INDEX_PAGE
# Ok, now let's create million statistics pages
for SITE in $SITES; do
echo "<div><a href=\"$SITE.html\">$SITE</a></div>" >> $INDEX_PAGE
$AWSTATS -config=$SITE -output -staticlinks > "$AWDIR/data/$SITE.html"
for REPORT in $REPORTS; do
custom_report $SITE $REPORT
done
done