From 8ddc93bf6bb816de1e279aa8cff379b248cede93 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sun, 27 Jan 2002 22:37:18 +0000 Subject: Small tweaks to localwebstats: - Include configfile path in error when config can't be loaded. - More DEBUG status messages. - Small cleanups here and there. --- localwebstats | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'localwebstats') diff --git a/localwebstats b/localwebstats index 819e777..c94fcb2 100755 --- a/localwebstats +++ b/localwebstats @@ -44,14 +44,12 @@ case "$stamp" in esac if [ "$stamp" = "ignore" ]; then - if [ $DEBUG ]; then - echo "Asked to ignore - exiting silently..." - fi + [ $DEBUG ] && echo "Asked to ignore - exiting silently..." exit 0 fi -WEBROOT=/var/www LOGROOT=/var/log/apache +WEBROOT=/var/www # Options: $1=LOGROOT, $2=WEBROOT, $3=WEBSITE function statsdir() { echo $2/VIRTUAL/stats.$(dnsdomainname)/www/$3; } @@ -69,9 +67,9 @@ function post_init() { true; } function pre_update() { true; } function post_update() { true; } -# The above can be overridden in /etc/local/www - -. /etc/local/www || exit1 "Unable to read prefs file" +# The above can be overridden +LOCALCONFIG=/etc/local/webstats.conf +. $LOCALCONFIG || exit1 "Unable to read local config file $LOCALCONFIG" # variables and functions too boring to be configurable JDRESOLVE_BIN="/usr/bin/jdresolve" @@ -111,9 +109,11 @@ for WEBSITE in $WEBSITES; do WEBALIZER_CFG=$(webalizer_cfg $LOGROOT $WEBROOT $WEBSITE) || exit1 "Unable to resolve WEBALIZER_CFG." if [ $stamp = "init" ]; then + [ $DEBUG ] && echo "Execute $WEBSITE PRE_INIT" pre_init $LOGROOT $WEBROOT $WEBSITE || exit1 "Error executing PRE_INIT." fi if [ $stamp = "update" ]; then + [ $DEBUG ] && echo "Execute $WEBSITE PRE_UPDATE" pre_update $LOGROOT $WEBROOT $WEBSITE || exit1 "Error executing PRE_UPDATE." fi @@ -141,7 +141,7 @@ for WEBSITE in $WEBSITES; do AWSTATS_OPTIONS="$AWSTATS_OPTIONS" fi - if [ $stamp = "init" -o $stamp = "init" ]; then + if [ $stamp = "init" ]; then [ $DEBUG ] && echo "$WEBSITE: Purge STATSDIR" rm -rf $STATSDIR mkdir $STATSDIR @@ -286,9 +286,11 @@ ShowFlagLinks=0 gzip -f9 $LOGDATA fi if [ $stamp = "init" ]; then + [ $DEBUG ] && echo "Execute $WEBSITE POST_INIT" post_init $LOGROOT $WEBROOT $WEBSITE || exit1 "Error executing POST_INIT." fi if [ $stamp = "update" ]; then + [ $DEBUG ] && echo "Execute $WEBSITE POST_UPDATE" post_update $LOGROOT $WEBROOT $WEBSITE || exit1 "Error executing POST_UPDATE." fi done -- cgit v1.2.3