[news.software.b] Is there a better sendbatch script? + My improvements

asp@cos.com (Andrew S. Partan) (04/02/88)

Does anyone have a better sendbatch script?  I have the one from B news
2.11 patchlevel 14.

The guts of the sendbatch.sh script basically looks like this (assuming
that you are using ihave/sendme):
	while there is a RMT or RMT.work or RMT.ihave file in /usr/spool/batch
		if there is a RMT.ihave file
			generate a ihave message (with inews)
		else
			batch up some news
		end if
	end while

What happens now (which I consider to be problems) is:
	1) If you are getting news while the sendbatch script is
	   running, is you generate lots of small ihave messages.
	2) Sometimes you can generate a ihave message that does not get
	   sent until the next sendbatch run (how this happens, I don't
	   know, but I suspect a timing problem with the running of
	   inews and the continuation of the sendbatch run).

I changed the sendbatch.sh script to the following (patch follows at
the end of this message):
	while there is a RMT or RMT.work or RMT.ihave file in /usr/spool/batch
		if there is a RMT.ihave file
			generate a ihave message (with inews)
		end if
		if there is a RMT or RMT.work file
			batch up some news
		end if
	end while

Has anyone else done something similar?  Or done something else that
they consider to be 'better'?  Or thinks that my changes will break
something?

Thanks,
	--asp (Andrew Partan @ Corporation for Open Systems)
	-- asp@cos.com or asp%cos.com@uunet.uu.net
	-- {uunet, sundc, decuac, hqda-ai, hadron}!cos!asp
	ASN.1 Object Identifier: "{joint-iso-ccitt mhs(6) group(6) 157}"
DISCLAIMER:  Opinions expressed are not necessarily those of the
Corporation for Open Systems, its members, or any standards body.

------------------------------------
*** sendbatch.sh.ORIG	Wed Mar  9 16:02:00 1988
--- sendbatch.sh	Fri Apr  1 14:04:57 1988
***************
*** 67,75 ****
  	: make sure $? is zero
  	sentbytes=0
  	while test $? -eq 0 -a $sentbytes -le $MAXBATCH -a \
! 		\( \( $sentbytes -eq 0 -a -s BATCHDIR/$rmt \) -o \
! 		 -s BATCHDIR/$rmt.work -o  \
! 		\( -n "$DOIHAVE" -a -s BATCHDIR/$rmt.ihave \) \)
  	do
  		if test -n "$DOIHAVE" -a -s BATCHDIR/$rmt.ihave
  		then
--- 67,75 ----
  	: make sure $? is zero
  	sentbytes=0
  	while test $? -eq 0 -a $sentbytes -le $MAXBATCH -a \
! 		\( -s BATCHDIR/$rmt -o \
! 		   -s BATCHDIR/$rmt.work -o \
! 		   \( -n "$DOIHAVE" -a -s BATCHDIR/$rmt.ihave \) \)
  	do
  		if test -n "$DOIHAVE" -a -s BATCHDIR/$rmt.ihave
  		then
***************
*** 77,84 ****
  			LIBDIR/inews -t "cmsg ihave $DOIHAVE" -n to.$rmt.ctl < \
  				BATCHDIR/$rmt.$$
  			rm BATCHDIR/$rmt.$$
! 					
! 		else
  			(eval $ECHO; eval $CMD $COMP $C7) |
  			if test -s BATCHDIR/$rmt.cmd
  			then
--- 77,85 ----
  			LIBDIR/inews -t "cmsg ihave $DOIHAVE" -n to.$rmt.ctl < \
  				BATCHDIR/$rmt.$$
  			rm BATCHDIR/$rmt.$$
! 		fi
! 
! 		if test -s BATCHDIR/$rmt -o -s BATCHDIR/$rmt.work
  			(eval $ECHO; eval $CMD $COMP $C7) |
  			if test -s BATCHDIR/$rmt.cmd
  			then