Fwd: Support for GZipped-Batches in sendbatch?

Russ Allbery rra at stanford.edu
Thu Jul 19 03:04:45 UTC 2001


Hello Jochen,

A little over a year ago, you sent mail to inn-suggest recommending that
sendbatch get a new -g option to send batches compressed with gzip.  Sorry
about the delay in responding to that suggestion.

> From: Jochen Erwied <jochen at erwied.de>
> To: inn-suggest at isc.org
> Subject: Support for GZipped-Batches in sendbatch?
> Date: Sun, 30 Jul 2000 14:45:14 +0200

> There seems to be support for compress only when sending out batches
> with sendbatch. I added support using gzip (options -g/+g). Maybe one
> should think about using bzip2, too. But this is far from being
> standard.

I don't think the +g option is needed; +c is used to indicate that no
compression is wanted, so there isn't really a logical meaning for a +g
option.

> Relevant part in sendbatch is:

>     -g)
>         COMP="; exec ${GZIP} ${GZIPFLAGS}"
>         ECHO="echo '#! cunbatch'"
>         continue
>         ;;

I believe that should be gunbatch.

> where GZIPFLAGS contains a '-9f'.

After some discussion on inn-workers, I left off -9; it adds a lot of CPU
time for very little gain in batch size.

> By the way: COMPFLAGS should be set to '-f' by default!

Yup, this was a bug; now fixed in STABLE.

I'm applying the following patch to CURRENT to add this feature and to fix
a few other things I noticed at the same time.

Index: sendbatch.in
===================================================================
RCS file: /dist1/cvs/isc/inn/inn/backends/sendbatch.in,v
retrieving revision 1.5
diff -u -r1.5 sendbatch.in
--- sendbatch.in	2000/05/03 01:57:54	1.5
+++ sendbatch.in	2001/07/19 03:04:18
@@ -1,24 +1,29 @@
 #! /bin/sh
 # fixscript will replace this line with code to load innshellvars
 
-##  $Revision: 1.5 $
+##  $Id$
+##
 ##  SH script to send UUCP batches out.  By Mike Cooper and Rich $alz.
+##
 ##  Based on B News sendbatch 1.22 10/29/89.
 
 ##  Place to run a df, and amount of space needed.
 UUSPOOL=/var/spool/uucp
 SPOOLFREE=20000
+
 ##  Program names and flags.  Most can be set on the command-line.
-C7=
 COMP=
-COMPFLAGS=
-# Use the COMPRESS variable as it is in innshellvars
-# COMPRESS=/usr/ucb/compress
+COMPFLAGS=-f
+GZIPFLAGS=-f
 ECHO=
+
 ##  Not a config param since this is the remote rnews.
 RNEWS=rnews
+
+##  UUCP command execution program.
 UUX=uux
 UUXFLAGS="- -r -n -gd"
+
 ##  Desired size of each batch, total number of bytes we want to queue.
 DEFBYTES=50000
 BYTESQUEUED=1000000000
@@ -28,7 +33,6 @@
 ##  Go to where the action is.
 cd ${BATCH}
 
-
 ##  Loop over command line.
 for SITE
 do
@@ -76,9 +80,13 @@
 	ECHO="echo '#! cunbatch'"
 	continue
 	;;
+    -g)
+        COMP="; exec ${GZIP} ${GZIPFLAGS}"
+        ECHO="echo '#! gunbatch'"
+        continue
+        ;;
     +c)
 	COMP=''
-	C7=''
 	ECHO=''
 	COMPFLAGS=''
 	continue
@@ -140,25 +148,14 @@
     fi
 
     ##  Check free space on the partition?
-#    if [ -n "${UUSPOOL}" ] ; then
-#	FREE=`(cd ${UUSPOOL}; df . | ${AWK} '
-#		$6 == "'${UUSPOOL}'" { print $4 ; exit }
-#		$1 == "'${UUSPOOL}'" && NF == 7 { print $4 ; exit }
-#		$2 == "'${UUSPOOL}'" { print $5 ; exit }
-#		$1 == "'${UUSPOOL}'" { print $3 ; exit }
-#	    ')`
-## = ()<	POS=@<INNWATCH_BLOCKS>@>()=
-	POS=4
-	DOLLAR="$"
-	FREE=`${INNDF} ${UUSPOOL}`
-	if [ -n "${FREE}" ]; then
-	  if [ "${FREE}" -lt ${SPOOLFREE} ] ; then
+    FREE=`${INNDF} ${UUSPOOL}`
+    if [ -n "${FREE}" ]; then
+        if [ "${FREE}" -lt ${SPOOLFREE} ] ; then
 	    echo "${PROG}:  No space on ${UUSPOOL} for ${SITE} (${FREE})."
 	    rm -f ${LOCK}
 	    continue
-	  fi
-	fi
-#    fi
+        fi
+    fi
 
     ##  Check the host's queue size?
     QUEUE=0
@@ -167,11 +164,11 @@
 	    # Get queue size from directory size
 	    QUEUE=`du -s "${UUSPOOL}/${SITE}" \
 		    | ${AWK} '{ printf("%s000\n", $1); }'`
-
 	else
 	    ##  Get queue size from uuq command.
-	    QUEUE=`uustat -s${SITE} -Sq 2>/dev/null | ${AWK} 'BEGIN {printf "expr "} /queued/ {printf "%s + ", $(NF-1)} END {printf "0\n"}' | sh`
-	fi
+	    QUEUE=`uustat -s${SITE} -Sq 2>/dev/null \
+                    | ${AWK} '/queued/ {total += $(NF-1)} END {print total}'`
+        fi
 	test -z "${QUEUE}" && QUEUE=0
 	if [ "${QUEUE}" -gt ${BYTESQUEUED} ] ; then
 	    echo "${PROG}:  ${SITE} has ${QUEUE} bytes queued."

-- 
Russ Allbery (rra at stanford.edu)             <http://www.eyrie.org/~eagle/>


More information about the inn-workers mailing list