Article View: news.admin
Article #4033Re: How to re-supply a days news feed.
From: Tony Birnseth
Date: Tue, 02 Dec 1986 22:09
Date: Tue, 02 Dec 1986 22:09
100 lines
3409 bytes
3409 bytes
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
Technical Details
Message-ID:
<1940@tektools.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!esosun!net1!sdcsvax!hp-sdd!hplabs!tektronix!tekgen!tektools!peewee!tonybReferences:
<152@van-bc.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!esosun!net1!sdcsvax!hp-sdd!hplabs!tektronix!tekgen!tektools!peewee!tonyb From: tonyb@peewee.uss.tek.com (Tony Birnseth) Newsgroups: news.admin,news.software.b Subject: Re: How to re-supply a days news feed. Message-ID: <1940@tektools.UUCP> Date: Tue, 2-Dec-86 17:09:14 EST Article-I.D.: tektools.1940 Posted: Tue Dec 2 17:09:14 1986 Date-Received: Fri, 5-Dec-86 21:28:35 EST References: <152@van-bc.UUCP> Sender: tonyb@tektools.UUCP Reply-To: tonyb@peewee.uss.tek.com (Tony Birnseth) Distribution: world Organization: Tektronix, Inc., Beaverton, OR. Lines: 100 Keywords: backup newsfeed