I've attached v2 patch.

It has break statement to stop at first iteration in case of error (if there are many 
database breaks as "month day hour").
diff --git a/debian/default/awstats b/debian/default/awstats
index cf06f7d..75a851f 100644
--- a/debian/default/awstats
+++ b/debian/default/awstats
@@ -17,3 +17,10 @@ AWSTATS_LANG="en"
 # This variable controls whether to run regular cron jobs for awstats.  Set
 # to "yes" or "no" (default to "yes").
 AWSTATS_ENABLE_CRONTABS="yes"
+
+# This variable controls how statistics are partitioned. Set "month", "day",
+# "hour" or a combination as "month day". If variable is not set, default
+# AWStats database break is used (month). Set additional CGI arguments as
+# "&databasebreak=hour&day=3&hour=14 to access summary of the specific hour
+# for the specific day.
+AWSTATS_DATABASE_BREAKS=
diff --git a/debian/update.sh b/debian/update.sh
index c83bfeb..7aad8fd 100755
--- a/debian/update.sh
+++ b/debian/update.sh
@@ -28,12 +28,17 @@ for c in `/bin/ls -1 awstats.*.conf 2>/dev/null | \
           /bin/sed 's/^awstats\.\(.*\)\.conf/\1/'` \
          `[ -f /etc/awstats/awstats.conf ] && echo awstats`
 do
-  if ! nice -n $AWSTATS_NICE $AWSTATS \
+  for b in ${AWSTATS_DATABASE_BREAKS:-""}
+  do
+    if ! nice -n $AWSTATS_NICE $AWSTATS \
+	  ${b:+-databasebreak=${b}} \
 	  -config=$c \
 	  -update >$ERRFILE 2>&1
-  then
-    echo "Error while processing" \
-         "/etc/awstats/awstats$(test $c != awstats && echo .$c).conf" >&2
-    cat $ERRFILE >&2 # an error occurred
-  fi
+    then
+      echo "Error while processing" \
+           "/etc/awstats/awstats$(test $c != awstats && echo .$c).conf" >&2
+      cat $ERRFILE >&2 # an error occurred
+      break
+    fi
+  done
 done

Reply via email to