Article View: de.admin.news.misc
Article #148Re: "Alte" News nochmal bereitstellen ?
From: Oliver Boehmer
Date: Thu, 08 Oct 1992 06:08
Date: Thu, 08 Oct 1992 06:08
130 lines
3969 bytes
3969 bytes
ralf@ptavv.ka.sub.org (Ralf Wenk) writes:
>>Gibt es eigentlich ein "einfache" Moeglichkeit, bereits
>>gebatchte News (die auch schon uebermittelt wurden),
>>nochmal bereitzustellen (d.h. in CNews das /usr/spool/news/out.going/kiste/togo
>>nochmal zu "fuellen") ?????
>
> Ja, z. B. mit einem geeigneten find
Ich habe mal so ein Script geschrieben, das auch automatisch die alle
Gruppen im Sys-File neu batched. Newsfrom habe ich dabei nicht benutzt,
dafuer aber ein nettes Tool: gngp, das alle Gruppen fuer einen bestimmten
Sys-Eintrag ausgibt. Das Programm ist sicher nicht das Schnellste, aber es
wird ja auch nicht zu oft benutzt (mit GNU-find geht's sicher noch
schneller).
Ich hoffe, jemand kann es gebrauchen.
oli
#!/bin/sh
# This is a shell archive (produced by shar 3.49)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# made 10/08/1992 06:05 UTC by oli@odbffm
# Source directory /usr/lib/newsbin/maint
#
# existing files will NOT be overwritten unless -c is specified
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 1616 -rwxrwxr-x mktogo
#
# ============= mktogo ==============
if test -f 'mktogo' -a X"$1" != X"-c"; then
echo 'x - skipping mktogo (File already exists)'
else
echo 'x - extracting mktogo (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'mktogo' &&
#! /bin/sh
#
# Build a new togo file in case of errors. Get all articles less then n
# days old based on subscription list
#
# =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
. ${NEWSCONFIG-/usr/lib/news/bin/config}
PATH=$NEWSCTL/bin:$NEWSBIN:$NEWSPATH ; export PATH
umask $NEWSUMASK
X
DAYS=1
X
USAGE="Usage: $0 [ -n ] host
X -n spool Articles less then n days old (Default=$DAYS)"
X
if [ $# = 0 ]; then
X echo "$USAGE" >&2
X exit 1
fi
X
case $1 in
X -*) DAYS=`echo $1 | sed 's/^-//'`
X # check if argument is numeric
X if expr $DAYS + 1 > /dev/null 2>&1 ; then
X : true
X else
X echo "Illegal argument: $1 (must be numeric)" >&2
X echo "$USAGE" >&2 ; exit 1
X fi; shift;;
esac
X
if [ $1 ]; then
X HOST=$1
else
X echo "$USAGE" >&2
X exit 1
fi
X
# locate subscription list
PAT=`nawk -f $NEWSBIN/relay/canonsys.awk $NEWSCTL/sys |
X sed -n "\#^$HOST[\/:]#p;\#^.*\/$HOST[\/:]#p" |
X awk -F: '
{
X fields = split($2, field2, "/") # split ngs/dists
X print field2[1] # print only ngs
X exit
}' `
X
if [ -z "$PAT" ]; then
X echo "$HOST not in $NEWSCTL/sys or no subscription list" >&2
X exit 1
fi
X
TOGO="$NEWSARTS/out.going/$HOST/togo"
X
if [ -r "$TOGO" ]; then
X LINES1=`wc -l $TOGO | awk '{ print $1 }' `
else
X LINES1=0
fi
X
GROUPS=`cat $NEWSCTL/active | sed 's/ .*//' | gngp -a "$PAT" | sed "s;\.;/;g"`
X
for DIR in $GROUPS ; do
X cd $NEWSARTS/$DIR || continue
X
X # Find Articles, but only print the ones in the current directory
X find . -type f -ctime -$DAYS -print | sed "/.*\/.*\// d;s;^\.;$DIR;"
X
done >> $TOGO 2>/dev/null
X
LINES2=`wc -l $TOGO | awk '{ print $1 }' `
X
echo "`eval expr $LINES2 - $LINES1 ` article(s) spooled for system $HOST" >&2
SHAR_EOF
chmod 0775 mktogo ||
echo 'restore of mktogo failed'
Wc_c="`wc -c < 'mktogo'`"
test 1616 -eq "$Wc_c" ||
echo 'mktogo: original size 1616, current size' "$Wc_c"
fi
exit 0
--
Oliver Boehmer, Frankfurt - Germany oli@odb.rhein-main.de
"...make -k all to compile everything in the core distribution. This will take
anywhere from 15 minutes (on a Cray Y-MP) to 12 hours." X Window Release Notes
Technical Details
Message-ID:
<ANQ7HAC@odb.rhein-main.de>Path:
arc1-ca.pugleaf.net!sparky!uunet!math.fu-berlin.de!ira.uka.de!smurf.sub.org!incom!odbffm!oliReferences:
<9QG7VXN@mailgzrz.tu-berlin.de>Show Full Headers
Complete Article Headers
Newsgroups: de.admin.news.misc Path: arc1-ca.pugleaf.net!sparky!uunet!math.fu-berlin.de!ira.uka.de!smurf.sub.org!incom!odbffm!oli From: oli@odb.rhein-main.de (Oliver Boehmer) Subject: Re: "Alte" News nochmal bereitstellen ? Message-ID: <ANQ7HAC@odb.rhein-main.de> References: <9QG7VXN@mailgzrz.tu-berlin.de> Date: Thu, 8 Oct 1992 06:08:53 GMT Lines: 130