add webalizer cronjob
This commit is contained in:
parent
6b5877baf8
commit
47933cdde2
39
webalizer.sh
Normal file
39
webalizer.sh
Normal 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
|
Loading…
Reference in New Issue
Block a user