summaryrefslogtreecommitdiff
path: root/localwebresolve
diff options
context:
space:
mode:
Diffstat (limited to 'localwebresolve')
-rwxr-xr-xlocalwebresolve24
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"