INN commit: branches/2.5/scripts (news.daily.in scanlogs.in)

INN Commit rra at isc.org
Tue Feb 16 19:50:00 UTC 2010


    Date: Tuesday, February 16, 2010 @ 11:50:00
  Author: iulius
Revision: 8988

scanlogs was expecting the default innfeed.conf file to look for the
log file to rotate.

Also fixed a bug in news.daily:  procbatch was called without specifying
the innfeed backlog directory.

Modified:
  branches/2.5/scripts/news.daily.in
  branches/2.5/scripts/scanlogs.in

---------------+
 news.daily.in |   60 +++++++++++++++++++++++++++++++++++---------------------
 scanlogs.in   |    7 ++++--
 2 files changed, 43 insertions(+), 24 deletions(-)

Modified: news.daily.in
===================================================================
--- news.daily.in	2010-02-16 19:48:45 UTC (rev 8987)
+++ news.daily.in	2010-02-16 19:50:00 UTC (rev 8988)
@@ -24,22 +24,29 @@
 ##      nostat               Do not run innstat
 ##      notdaily             Not a daily run, and therefore implies nologs
 ##      postexec=xxx         Path to a program to run after expiring
+##      procbatchdir=xxx     Directory in which to run procbatch
 ##      tmpdir=xxx           Working directory for `sort' and such
 ##      /full/path           Path to a program to run before expiring
 
 EXPLOG=${MOST_LOGS}/expire.log
 INNSTAT=${PATHBIN}/innstat
+INNFEEDCONF=${PATHETC}/innfeed.conf
 HOSTNAME=`hostname`
 DATE=`date`
 TAGGEDHASH=${DO_DBZ_TAGGED_HASH}
 
 ##  Try to find the path to innfeed's spool.  The default is
 ##  ${PATHSPOOL}/innfeed if not found.
-INNFEEDSPOOL=`${AWK} '{gsub(/:|#/, " & ")} {if ($1 == "backlog-directory" && $2 == ":") print $3}' ${PATHETC}/innfeed.conf`
-test -z "${INNFEEDSPOOL}" && test -f "${PATHSPOOL}/innfeed" && INNFEEDSPOOL="innfeed"
+PROCBATCHDIR=
+if [ -f "${INNFEEDCONF}" ]; then
+    INNFEEDSPOOL=`${AWK} '{gsub(/:|#/, " & ")} {if ($1 == "backlog-directory" && $2 == ":") print $3}' ${INNFEEDCONF}`
+fi
+test -z "${INNFEEDSPOOL}" && test -d "${PATHSPOOL}/innfeed" && INNFEEDSPOOL="innfeed"
+test -n "${INNFEEDSPOOL}" && PROCBATCHDIR="${PATHSPOOL}/${INNFEEDSPOOL}"
 
 ##  If your expire does not pause or throttle innd, enable this next line:
 #MESSAGE="Expiration script $$"
+
 ##  Renumber all at once, or in steps?  Set to the delay if steps (that
 ##  may take a long time!).
 RENUMBER=
@@ -109,6 +116,9 @@
     Xexpdir=*)
 	EXPDIR=`expr "${I}" : 'expdir=\(.*\)'`
 	;;
+    Xprocbatchdir=*)
+        PROCBATCHDIR="${PROCBATCHDIR} `expr "${I}" : 'procbatchdir=\(.*\)'`"
+        ;;
     Xtmpdir=*)
 	TMPDIR=`expr "${I}" : 'tmpdir=\(.*\)'`
 	;;
@@ -231,29 +241,35 @@
     exec 3>&1 >${TEMP} 2>&1
 fi
 
-if [ "${DOPROCBATCH}" = "true" ] && [ -d "${PATHSPOOL}/${INNFEEDSPOOL}" ]
+if [ "${DOPROCBATCH}" = "true" ]
 then
-    cd "${PATHSPOOL}/${INNFEEDSPOOL}"
+    for DIRECTORY in ${PROCBATCHDIR}
+    do
+        if [ -d "${DIRECTORY}" ]
+        then
+            cd "${DIRECTORY}"
 
-    # Find the PIDs of innfeed.
-    INNFEEDLOCKS=`cat *.lock 2>/dev/null | ${SORT} -u`
+            # Find the PIDs of innfeed.
+            INNFEEDLOCKS=`cat *.lock 2>/dev/null | ${SORT} -u`
 
-    # Process files like "innfeed-dropped.A001703" where
-    # 1703 is not in $INNFEEDLOCKS.
-    for file in `find . -name "innfeed-dropped*" -print`
-    do
-        PID=`echo "$file" | ${SED} 's/^.*[A-Z]0*//'`
-        FOUND=false
-        for INNFEEDLOCK in $INNFEEDLOCKS
-        do
-            if [ "$PID" = "$INNFEEDLOCK" ]
-            then
-                FOUND=true
-            fi
-        done
-        if [ "$FOUND" = "false" ]
-        then
-            ${PATHBIN}/procbatch -qmu $file
+            # Process files like "innfeed-dropped.A001703" where
+            # 1703 is not in $INNFEEDLOCKS.
+            for file in `find . -name "innfeed-dropped*" -print`
+            do
+                PID=`echo "$file" | ${SED} 's/^.*[A-Z]0*//'`
+                FOUND=false
+                for INNFEEDLOCK in $INNFEEDLOCKS
+                do
+                    if [ "$PID" = "$INNFEEDLOCK" ]
+                    then
+                        FOUND=true
+                    fi
+                done
+                if [ "$FOUND" = "false" ]
+                then
+                    ${PATHBIN}/procbatch -qmu -t ${DIRECTORY} $file
+                fi
+            done
         fi
     done
 fi

Modified: scanlogs.in
===================================================================
--- scanlogs.in	2010-02-16 19:48:45 UTC (rev 8987)
+++ scanlogs.in	2010-02-16 19:50:00 UTC (rev 8988)
@@ -22,12 +22,15 @@
 ##  Where these programs, if used, write their logs.
 ##  We also have to find innfeed's log file.
 CONTROLBATCH=${MOST_LOGS}/controlbatch.log
-INNFEEDLOG=`${AWK} '{gsub(/:|#/, " & ")} {if ($1 == "log-file" && $2 == ":") print $3}' ${PATHETC}/innfeed.conf`
+INNFEEDCONF=${PATHETC}/innfeed.conf
+if [ -f "${INNFEEDCONF}" ]; then
+    INNFEEDLOG=`${AWK} '{gsub(/:|#/, " & ")} {if ($1 == "log-file" && $2 == ":") print $3}' ${INNFEEDCONF}`
+fi
 INNFEED=
 for F in "${INNFEEDLOG}" ; do
     test -f "${MOST_LOGS}/${F}" && INNFEED="${INNFEED} ${MOST_LOGS}/${F}"
 done
-test -z "${INNFEED}" && test -f ${MOST_LOGS}/innfeed.log && INNFEED="${MOST_LOGS}/innfeed.log"
+test -z "${INNFEED}" && test -f "${MOST_LOGS}/innfeed.log" && INNFEED="${MOST_LOGS}/innfeed.log"
 NNTPSEND=${MOST_LOGS}/nntpsend.log
 PERLNOCEM=${MOST_LOGS}/perl-nocem.log
 SENDIHAVE=${MOST_LOGS}/send-ihave.log




More information about the inn-committers mailing list