[news.admin] How to re-supply a days news feed.

sl@van-bc.UUCP (Stuart Lynne) (11/29/86)

If you have sites downstream who occasionally drop some news on the
floor and ask you to resupply here's a quick fix to make it easy to
do so. 

First add a line in your /usr/lib/news/sys file:

	backup:world,comp,sci,news,rec,soc,talk,misc,net,mod,na,usa,to:F

This will copy the name of every file you receive into a batch file in your
batch directory (we presume here that you don't feed a node called backup).

Next in your daily script for running expire:

	cd /usr/spool/batch
	mv backup.3.Z backup.4.Z
	mv backup.2.Z backup.3.Z
	mv backup.1.Z backup.2.Z
	mv backup backup.1
	compress backup.1

This will keep the last four days of news batch files present in your batch
directory. To resend a particular day simply:

	zcat backup.?.Z > sysname

where sysname is the node name of the system requesting the feed again.


------------------------------------------------------------------------
Stuart Lynne  	Public Access Network - Vancouver BC 	
UUCP:		ihnp4!alberta!ubc-vi!van-bc!sl
Mail:		225B Evergreen Dr., Port Moody, BC, Canada, V3H 1S1
Phone: 		604-937-7532

tonyb@peewee.uss.tek.com (Tony Birnseth) (12/03/86)

In article <152@van-bc.UUCP> sl@van-bc.UUCP (Stuart Lynne) writes:
>
>If you have sites downstream who occasionally drop some news on the
>floor and ask you to resupply here's a quick fix to make it easy to
>do so. 
>

Below is a shell script I run when file systems fill up or a downstream
site has other problems.  There are couple of things that it doesn't account 
for:
   It is not sensitive to exclusions in the sys file since inews(8) is not 
   involved.  It will send all news received on the dates given as arguments 
   on the command line to all the named hosts (prompted for by the program).

Usage is 'resend mm/dd/yy ....'

After it builds a temporary file containing all the articles received on the
named dates, it will prompt for the sites to send the new batch to.  This is 
a space separated list of site names.  The temporary file is appended to
/usr/spool/batch/$site.

It's not the fastest thing in the world, but does the job effectively for me.

Hope it's of use to someone.

Tony Birnseth
--------------------------------------------------------------------------------
#! /bin/csh -f
#
# $Header: resend.csh,v 1.9 86/10/09 13:07:45 news Exp $
#
# Resend news articles for dates given. (actually build a batch file)
# Dates must be of the form "mm/dd/yy"
#
# NOTE: If your news spool directory is not in /usr/spool/news, edit the 
# 'sed' command below to get the correct leading path inserted at the front
# of the pathnames listed in the batch file.
#

set Usage = "Usage: resend date ..."

set HISTORY = /usr/lib/news/history
set tmp = /tmp/resend.$$
set batch = /tmp/batch.$$

onintr done

if ( $#argv < 1 ) then
	echo $Usage
	exit 1
endif

@ i = 1
while ( $i <= $#argv )
	if ( "$argv[$i]" !~ [0-9][0-9]/[0-9][0-9]/[0-9][0-9] ) then
		echo "Invalid date format <$argv[$i]> must be of form mm/dd/yy"
		exit 1
	endif
	@ i++
end

# write out an awk script
echo "{" > $tmp
@ i = 1
echo -n "	if ( " >> $tmp
while ( 1 )
	echo -n '$2 == ' >> $tmp
	echo -n '"' >> $tmp
	echo -n $argv[$i] >> $tmp
	echo -n '" ' >> $tmp
	@ i++
	if ( $i > $#argv ) then
		echo ") " >> $tmp
		break
	else
		echo -n " || " >> $tmp
end
echo '		print $4 ' >> $tmp
echo "}" >> $tmp

#
# NOTE: Change path to spool directory here if necessary
#
awk -f $tmp $HISTORY | sed 	-e 's;\.;/;g' \
				-e 's;^;/usr/spool/news/;' \
				-e '/cancelled$/d' > $batch
set cnt = `wc $batch`
echo "";echo Total == $cnt[1] news articles  batched.

echo "";echo -n "Which machines? "
set hosts = ($<)
foreach i ( $hosts )
	if ( "$i" == "" ) break
	cat $batch >> /usr/spool/batch/$i
	ls -l /usr/spool/batch/$i
end

done:
rm -f $batch
rm -f $tmp

dave@lsuc.UUCP (12/03/86)

In article <152@van-bc.UUCP> sl@van-bc.UUCP (Stuart Lynne) writes:
>
>If you have sites downstream who occasionally drop some news on the
>floor and ask you to resupply here's a quick fix to make it easy to
>do so. 

Stuart's suggestion is fine if you have lots of spare disk space.

Here's a simpler solution, usable if you feed batches and can easily
identify the top-level directory or directories of the groups you
feed (i.e., you feed something straightforward, like all of news
or all of comp):

find /usr/spool/news/comp -type f -mtime -2 -print >> /usr/spool/batch/xyz

This will feed the last 2 days' news in comp.* to site "xyz".

Dave Sherman
The Law Society of Upper Canada
Toronto
-- 
{ ihnp4!utzoo  seismo!mnetor  utai  hcr  decvax!utcsri  } !lsuc!dave