diff options
author | Jonas Smedegaard <dr@jones.dk> | 2004-05-11 10:07:52 +0000 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2004-05-11 10:07:52 +0000 |
commit | 281a91cba315074d6ddfb3ca21fe5f7ad5d3d936 (patch) | |
tree | a0da0c0b82a40492178740fde1c5b463a771474a | |
parent | c891316bfc589d959f14a4620283fe461308cfaa (diff) |
Fix jdresolve database use.
-rwxr-xr-x | localwebresolve | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/localwebresolve b/localwebresolve index bd9817d..f361897 100755 --- a/localwebresolve +++ b/localwebresolve @@ -3,7 +3,7 @@ # /usr/local/sbin/localwebresolve # Copyright 2002 Jonas Smedegaard <dr@jones.dk> # -# $Id: localwebresolve,v 1.4 2003-05-22 12:27:34 jonas Exp $ +# $Id: localwebresolve,v 1.5 2004-05-11 10:07:52 jonas Exp $ # # Webstats maintenance script # @@ -53,19 +53,20 @@ LOCALCONFIG=/etc/local/webresolve.conf # variables and functions too boring to be configurable JDRESOLVE_BIN="/usr/bin/jdresolve" +JDRESOLVE_OPTIONS="-r -t 5" JDRESOLVE_DB="/var/cache/jdresolve/hosts.db" -#JDRESOLVE_OPTIONS="-r -t 5 --database=$JDRESOLVE_DB --dbfirst --expiredb=48" -# DB access doesn't work currently (no output...) -#JDRESOLVE_OPTIONS="-r --database=$JDRESOLVE_DB --dbfirst --expiredb=48" -JDRESOLVE_OPTIONS="-r" -JDRESOLVE_MERGE_OPTIONS="--mergedb --database=$JDRESOLVE_DB" +JDRESOLVE_EXPIRY="48" LOGRESOLVE_BIN="/usr/sbin/logresolve" -# Webiste/independent checks +# Website/independent checks test -d $WEBROOT || exit1 "Webroot \"$WEBROOT\" doesn't exist" test -d $LOGROOT || exit1 "Logroot \"$LOGROOT\" doesn't exist" -if [ -x $JDRESOLVE_BIN ]; then - touch $JDRESOLVE_DB || exit1 "Couldn't touch JDRESOLVE_DB" +if [ -x "$JDRESOLVE_BIN" -a -n "$JDRESOLVE_DB" ]; then + JDRESOLVE_OPTIONS="$JDRESOLVE_OPTIONS --database=\"$JDRESOLVE_DB\"" + test -d $(basedir "$JDRESOLVE_DB") || exit1 "Cache dir for jdresolve doesn't exist" + if [ -n "$JDRESOLVE_EXPIRY" ]; then + jdresolve $JDRESOLVE_OPTIONS --expiredb="$JDRESOLVE_EXPIRY" + fi fi # Resolve logs for websites from stdin or all default sites @@ -82,7 +83,7 @@ for WEBSITE in $WEBSITES; do echo "Resolving logfiles $YEARDOTMONTH for $WEBSITE in $RESOLVEDDIR:" JDRESOLVE_OPTIONS="$JDRESOLVE_OPTIONS -p" else - JDRESOLVE_OPTIONS="$JDRESOLVE_DB -n" + JDRESOLVE_OPTIONS="$JDRESOLVE_OPTIONS -n" fi LOGDATA="$RESOLVEDDIR/$YEARDOTMONTH.00" @@ -92,9 +93,6 @@ for WEBSITE in $WEBSITES; do if [ -x $JDRESOLVE_BIN ]; then [ $DEBUG ] && echo "$WEBSITE: DNS-resolve new logdata using jdresolve" -# DB access doesn't work currently (no output...) -# logcontent $LOGROOT $WEBROOT $WEBSITE | $JDRESOLVE_BIN $JDRESOLVE_OPTIONS - >> $LOGDATA -# jdresolve $JDRESOLVE_MERGE_OPTIONS $LOGDATA logcontent $LOGROOT $WEBROOT $WEBSITE | $JDRESOLVE_BIN $JDRESOLVE_OPTIONS - >> $LOGDATA elif [ -x $LOGRESOLVE_BIN ]; then [ $DEBUG ] && echo "$WEBSITE: DNS-resolve new logdata using logresolve" |