#!/bin/sh

# This script written by Cyrille Chepelov <cyrille@chepelov.org>

AWSTATS="/usr/lib/cgi-bin/awstats.pl -config=/etc/awstats/awstats.conf"
TARGET=/var/www

# source user's overrides (TODO: provide commented out template file)

[ -f /etc/awstats/awstats-static.conf ] && . /etc/awstats/awstats-static.conf

$AWSTATS -update
$AWSTATS -output -staticlinks > $TARGET/awstats.html

for detail in allhosts lasthosts unknownip urldetail unknownreferer unknownrefererbrowser browserdetail allkeyphrases errors404; do
	$AWSTATS -output=$detail -staticlinks > $TARGET/awstats.$detail.html
done

