add webalizer cronjob

This commit is contained in:
Olaf Rempel 2006-07-27 12:00:28 +02:00
parent 6b5877baf8
commit 47933cdde2
1 changed files with 39 additions and 0 deletions

39
webalizer.sh Normal file
View File

@ -0,0 +1,39 @@
#!/bin/sh
# webalizer cronjob
# 07/2006 ore
CONF_DIR=/etc/webalizer.d
WEBALIZER=/usr/bin/webalizer
[ -f ${WEBALIZER} ] || exit 0
# for all configs
for config in $CONF_DIR/*.conf; do
logfile=$(awk '/^LogFile/{print $2}' $config)
outputdir=$(awk '/^OutputDir/{print $2}' $config)
# output directory missing - create & parse *all* logs
[ -d ${outputdir} ] || {
mkdir -p $outputdir
# all logs in reversed order
for log in `ls -1tr ${logfile}.*.gz 2> /dev/null`; do
# echo $log
zcat $log | $WEBALIZER -c $config -q -
done
}
# rotated, not compressed logfile
[ -f ${logfile}.1 ] && {
# echo ${logfile}.1
$WEBALIZER -c $config -q ${logfile}.1
}
# current logfile (as given in config)
[ -f ${logfile} ] && {
# echo $logfile
$WEBALIZER -c $config -q
}
done