[news.sysadmin] How do I junk junk?

mechjgh@tness1.UUCP (Greg Hackney 214+464-2771) (11/30/87)

Dear Abby,

Once I have fixed a broken newsgroup, what is the
best way to get the files out of "junk" and into
the proper newsgroup. (version B 2.11)

The Junk Yard Dog


--
Greg Hackney
mechjgh@tness1.uucp
{ihnp4,bellcore,killer,petro}!tness1!mechjgh

dlm@cuuxb.ATT.COM (Dennis L. Mumaugh) (12/10/87)

In article <282@tness1.UUCP> mechjgh@tness1.UUCP (Greg Hackney 214+464-2771) writes:
>
>Dear Abby,
>
>Once I have fixed a broken newsgroup, what is the
>best way to get the files out of "junk" and into
>the proper newsgroup. (version B 2.11)
>
>The Junk Yard Dog
>
>
>--
>Greg Hackney
>mechjgh@tness1.uucp
>{ihnp4,bellcore,killer,petro}!tness1!mechjgh

Try the following (Bourne) shell script, hack it until it  works,
note  well,  that  it  does  not edit the active file and fix the
newsgroup entry for minimum article number  and  maximum  article
number.  That I do manually (or ask expire -u to do).

----- cut ---- here ---- cut ---- here ----
#! /bin/sh
# @(#)mvjunk.sh   (TRW Advanced Technology Facility) STA 2-Jun-1985
#
# Modified 10/22/85-James M. Scardelis, SA, Warner Computer Systems
#       to create newsgroups locally only.
#
# Move news files out of junk and into their proper directories,
# updating the active list and localgroups as we go.  Unknown newsgroups
# are created LOCALLY and the article installed.
#
# Be CAREFULL with that active list!  Although we try to write out
# buffers as quickly as possible, conflicts can occur if someone else
# tries to use it at the same time this script is running!
#
# Strange occurences are dribbled into mvjunk-log.
#
# TRW DSG EDS SISD SDL ATF STA
#
# Modified by Dennis L. Mumaugh for local conditions and made totally
# unrecognizable

JUNK=/usenet/spool/junk
NEWSDIR=/usenet/spool
LIB=/usenet/lib	
BIN=/usenet/bin
ACTIVE=$LIB/active
PATH=$PATH:$LIB:$BIN
tmp1=/tmp/news.dirs
cd $JUNK
if test -z "`ls`" 
then 
echo nothing in $JUNK
exit
fi
for j in $JUNK/[01-9]*
do
	echo working on article $j
	for group in `egrep '^Newsgroups:' $j | head -1 | \
		sed 's;Newsgroups:[ 	];;' | \
		sed 's;,; ;g'`
	do
		GROUPDIR=`echo $group | sed 's;\.;\/;g'`
		cd $NEWSDIR
		if test -d $GROUPDIR ; then
			cd $GROUPDIR
			l=`ls -r|egrep "^[01-9] | sort -r -n | head -1`
			if test -n "$l" ; then
					if test -f "$l" ; then
						article=`expr $l + 1`
					fi
			else
				article=1
			fi
		else
			newgroup $group
			article=1
		fi
		while test -f "$NEWSDIR/$GROUPDIR/$article" ; 
		do
			# echo directory $NEWSDIR/$GROUPDIR/$article exists!
			article=`expr $article + 1`
		done
		echo posting $j as $NEWSDIR/$GROUPDIR/$article
		ln $j $NEWSDIR/$GROUPDIR/$article
		echo $group: $article  >>$tmp1
	done
	echo removing $j
	/bin/rm -f $j		# But my MOTHER lives in Hackensack!
done
sort -u $tmp1 -o $tmp1
echo The file $tmp contains a list of articles and numbers:
echo Use it to edit $ACTIVE.
cat $tmp1
exit

----- end of file ------
-- 
=Dennis L. Mumaugh
 Lisle, IL       ...!{attunix,ihnp4,cbosgd,lll-crg}!cuuxb!dlm