#!/bin/sh

# This is a simple batcher for UUCP.

# Configuration section

# space-seperated list of UUCP nodes
NODES="abaris rivendell esmay"

# where is DNews dumping the bag-files?
BAGDIR="/var/spool/uucp-batches"

# where can we stick temporary files?
TMPDIR="/tmp"

# configuration ends here.

for n in $NODES; do
	cd $BAGDIR/$n
	for x in *.BAG; do
		if [ -e $x ]; then
			mv $x $TMPDIR/$n.$x
			echo "#! cunbatch" > $TMPDIR/batch.$n.$x
			cat $TMPDIR/$n.$x | compress -b 12 >> $TMPDIR/batch.$n.$x
			cat $TMPDIR/batch.$n.$x | uux - -r -gd $n!rnews
			rm $TMPDIR/batch.$n.$x
			rm $TMPDIR/$n.$x ;
		fi ;
	done ;
done
