Path: utzoo!utgpu!water!watmath!clyde!rutgers!sri-spam!ames!lll-lcc!unisoft!gethen!farren From: farren@gethen.UUCP (Michael J. Farren) Newsgroups: news.software.b Subject: Patch to limit nightly batches Message-ID: <669@gethen.UUCP> Date: 9 Feb 88 23:10:34 GMT Reply-To: farren@gethen.UUCP (Michael J. Farren) Organization: There's Unix there in Oakland Lines: 145 Recently, I have seen a singularly unpleasant phenomenon - after several days of no new news at all, ten to fifteen megabytes of news will arrive in one big lump. What I think is happening is that an upstream site has a nearly full spool directory, and when it starts to send (or receive) news, cannot accept the transactions. When expire is run, there is space, so all of the pent-up news is sent downstream at once, which, unfortunately, may well cause the downstream site's spool directory to become full, reproducing the problem. Bad enough in itself, this problem can also cause articles, mail, and other uucp transactions to be lost, as they fall out of the bottom of the full spool directories. If I'm way off base in my suppositions or my solutions, please let me know. -------- This is a set of context diffs which, when applied to the standard 'sendbatch' script, will produce a script which will attempt to limit the total amount of news passed to a downstream site on any given night. Properly applied, it should not cause anything to be lost, just spread over time, so that variations in news flow will tend to be evened out, avoiding overpopulation problems in spool directories. There has been an additional flag added to the command line syntax of sendbatch. This flag, -l, will invoke the limiting function. A typical entry in crontab for the new sendbatch would look like: sendbatch -c -l systemname The limits are set with the DAILY parameter. Edit the script to fit your own needs; the value is currently set at 5000000, which is somewhat larger than the average daily news volume, but small enough to help. Note that this doesn't represent the actual volume of news - it's simply a counter, used in conjunction with the value batch uses to limit the size of its batches. For example, the standard limitation number used by batch is 50000. With this value, sendbatch invoked with the limit flag will limit itself to 10 batches per night. On average, this should come pretty close to the DAILY figure. -------- Diffs follow - cut here -------- *** sendbatch.old Thu Sep 10 03:50:47 1987 --- sendbatch Tue Feb 9 14:25:00 1988 *************** *** 1,4 : '@(#)sendbatch.sh 1.10 9/23/86' cflags= LIM=50000 --- 1,5 ----- : '@(#)sendbatch.sh 1.10 9/23/86' + : 'Modified for batch limiting 2/09/88' cflags= LIM=50000 *************** *** 2,7 cflags= LIM=50000 CMD='/usr/lib/news/batch /usr/spool/batch/$rmt $BLIM' ECHO= COMP= --- 3,10 ----- cflags= LIM=50000 + DAILY=5000000 + TOTAL= CMD='/usr/lib/news/batch /usr/spool/batch/$rmt $BLIM' ECHO= COMP= *************** *** 31,36 DOIHAVE=`uuname -l` fi continue;; esac if test -n "$COMP" --- 34,41 ----- DOIHAVE=`uuname -l` fi continue;; + -l) TOTAL=0 + continue;; esac if test -n "$COMP" *************** *** 52,57 else (eval $ECHO; eval $CMD $COMP $C7) | if test -s /usr/spool/batch/$rmt.cmd then /usr/spool/batch/$rmt.cmd --- 57,63 ----- else (eval $ECHO; eval $CMD $COMP $C7) | + if test -s /usr/spool/batch/$rmt.cmd then /usr/spool/batch/$rmt.cmd *************** *** 57,62 /usr/spool/batch/$rmt.cmd else uux - -r $rmt!$RNEWS fi fi done --- 63,81 ----- /usr/spool/batch/$rmt.cmd else uux - -r $rmt!$RNEWS + fi + + if test -n $TOTAL + then + TOTAL=`expr $TOTAL + $LIM` + if test $TOTAL -ge $DAILY + then + if test -f /usr/spool/batch/$rmt.work + then + mv /usr/spool/batch/$rmt.work /usr/spool/batch/$rmt + fi + break + fi fi fi done -- Michael J. Farren | "INVESTIGATE your point of view, don't just {ucbvax, uunet, hoptoad}! | dogmatize it! Reflect on it and re-evaluate unisoft!gethen!farren | it. You may want to change your mind someday." gethen!farren@lll-winken.llnl.gov ----- Tom Reingold, from alt.flame