[news.sysadmin] active file

bowen@sunybcs (Devon E Bowen) (05/03/88)

Does anyone know of any magic to rebuild the active file? I accidently
removed ours the other day (don't ask) and had to make the following
shell script to re-build it. The shell script requires a file of all
the groups which I got from the oactive file. You also have to reset
all the moderated newsgroups by hand. Is there something I'm missing
or is this the best way to do it? (I'm not talking about improving this
script - I know it could be better)

Devon

----------------
#!/bin/csh -f

set NEWACTIVE=/usr/lib/news/new_active
set curr=`pwd`
cp /dev/null $NEWACTIVE

foreach group (`cat ~bowen/temp`)
	if ( -d /usr/spool/news/$group ) then
		cd /usr/spool/news/$group
		ls [0-9]* | awk '{ printf "%05d\n",$1 }' | sort > ~bowen/temp2
		if ( $status == 1 ) then
			set high=00000
			set low=00000
		else
			set high=`tail -1 ~bowen/temp2`
			set low=`head -1 ~bowen/temp2`
		endif
		echo -n "$group " >> $NEWACTIVE
		echo -n "$high " >> $NEWACTIVE
		echo -n "$low " >> $NEWACTIVE
		echo y >> $NEWACTIVE
		echo $group
	else
		echo $group does not exist
	endif
end