[net.news.adm] 2.10.1 active maintainer script

barto@celerity.UUCP (David Barto) (11/30/84)

# This is a shar archive.  Extract with sh, not csh.
cat < 'END-HEADER'
This is for all those sites that do NOT run 2.10.2 (or better :-) news.
Take the list that spaf presents, and shove it into the script
Update.active.  It strips and cleans it, then allows you to edit
the results, and will then perform 'rmgroup' (included) on the
resulting file.

Edit Mkdead, changing 'sdnet', and 'ca' to reflect your local
groups you want saved.

Try them out bit at a time just to make sure they work.

[You should get 'End of distribution' if you got the whole thing]

Enjoy.....

	barto (david barto)	Tele : (619) 271 9940
	uucp : {decvax || ucbvax || ihnp4}!sdcsvax!celerity!barto
	uucp : akgua!celerity!barto
	arpa : sdcsvax!celerity!barto@NOSC

END-HEADER
echo x - rmgroup
cat > rmgroup << '!Funky!Stuff!'
#! /bin/sh
# from : sdcsvax!sdcrdcf!hplabs!hao!seismo!rlgvax!cvl!umcp-cs!eneevax!chris
#
# @(#)rmgroup.sh	(U of Maryland) FLB 28-Jun-1983
#			Bug fixes 5 June 1984 Chris Torek
#
# Delete a newsgroup

lib=/usr/new/lib/news
spool=/usr/spool/news

for group
do
	qgrp="`echo $group | sed 's/\./\\\./g'`"
	if
		grep -s "^$qgrp " $lib/active
	then
		ed - $lib/active << xxxFOOxxx
/^$qgrp /d
w
q
xxxFOOxxx
	else
		echo "$0: $group: no such active line" 2>&1
	fi

	dir=$spool/"`echo $group | sed 's/\./\//g'`"
	if [ -d "$dir" ]
	then
		/bin/rm -rf "$dir"
	else
		echo "$0: $dir: no spool directory" 2>&1
	fi
done
exit 0
!Funky!Stuff!
echo x - Mkactive
cat > Mkactive << '!Funky!Stuff!'
#!/bin/sh
# see Update.active for this usage
#
sed -e '1,/---/d'\
	-e '1,/---/d'\
	-e 's/^[	]//'\
	-e 's/	\(.*\)//'\
	active.current | sort | sed -e '1,/Newsgroup/d' > current
sed -e 's/ \(.*\)//' /usr/new/lib/news/active | sort > active
diff active current > /tmp/active.diff
echo "# active newsgroups not in local active file:"
fgrep ">" /tmp/active.diff
echo "# defunct newsgroups still in active file (also local groups):"
fgrep "<" /tmp/active.diff
/bin/rm current active /tmp/active.diff
!Funky!Stuff!
echo x - Mkdead
cat > Mkdead << '!Funky!Stuff!'
#!/bin/sh
# see Update.active for usage
# change all groups that we have (but shouldn't) to be removed,
# and change all groups that we dont have (but sould) to be a comment
sed	-e '/general/d'\
	-e '/control/d' \
	-e '/junk/d' \
	-e '/sources/d' \
	-e '/ca.*/d' \
	-e '/sdnet.*/d' \
	-e 's,<,./rmgroup,' \
	-e 's,>,#,'
!Funky!Stuff!
echo x - Update.active
cat > Update.active << '!Funky!Stuff!'
#!/bin/sh
if test ! -r active.current
then
	echo "current active list must be in file \"active.current\""
	exit 1
fi

cat > DEAD.GROUPS <<'EOF'
# remove all lines that you want to keep in the active list
#
EOF
./Mkactive | ./Mkdead >> DEAD.GROUPS

${EDITOR-vi} DEAD.GROUPS
/bin/sh -v DEAD.GROUPS
/bin/rm DEAD.GROUPS
!Funky!Stuff!
echo "End of distribution"
exit 0
-- 
	barto (david barto)	Tele : (619) 271 9940
	uucp : {decvax || ucbvax || ihnp4}!sdcsvax!celerity!barto
	uucp : akgua!celerity!barto
	arpa : sdcsvax!celerity!barto@NOSC