Xref: utzoo news.admin:6595 comp.unix.xenix:7162 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!cica!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!ginosko!uunet!virtech!dennis From: dennis@virtech.UUCP (Dennis P. Bednar) Newsgroups: news.admin,comp.unix.xenix Subject: Re: Need help with updating active file Message-ID: <1028@virtech.UUCP> Date: 17 Aug 89 07:26:09 GMT References: <26@dynasys.UUCP> Distribution: usa Organization: Virtual Technologies Inc Lines: 123 In article <26@dynasys.UUCP>, root@dynasys.UUCP (Super user) writes: > I'm new to using news and I need some help. I am running Xenix and received > their version of netnews. The active file was old (still had mod in it). > I need to update it completely but I don't know how I should do this. Can > anyone help me out? I recently installed netnews here, and ran into the same problem you speak of. What I did was to uucp the latest newsgroups file from a neighboring UUCP site, then I ran a shell script, addgroups.sh, that read the latest newsgroups file, extracted only the newsgroup name, and then searched the active file to see if the newsgroup was already there. If not, it runs "inews -C newsgroup addgroup.sh # /bin/sh # addgroup.sh # read the current newsgroups file and generate newsgroups if the name in # column one is a new newsgroup, that is, the name is not already # in the active file # This procedure was used to generate the newsgroups based on latest # information from rlgvax on Aug 4 89. dennis tmpfile=/tmp/news$$ trap "rm -f $tmpfile" 0 1 2 15 # copy to temp file that we can edit # keep only column 1 which are the newsgroup names cp newsgroups $tmpfile ed $tmpfile </dev/null >/dev/null 1,\$s/ .*// 1,\$s/ .*// w q EOF cat $tmpfile | while read group do grep $group active >/dev/null if [ $? -eq 0 ] then : # found it else echo Adding newsgroup $group /usr/lib/news/inews -C $group diffac.sh # diff the active vs the newsgroup file # this is useful for making sure that both files are in sync with one another # temporary files, removed upon exit tmpfilex=/tmp/$$xx # /tmp/$$xx tmpfiley=/tmp/$$yy # /tmp/$$yy act_not_news=/tmp/$$act_not_news # in active file but not in newsgroups news_not_act=/tmp/$$news_not_act # in newsgroups file but not in active trap "rm -f $tmpfilex $tmpfiley $act_not_news $news_not_act" 0 1 2 15 # copy to temp file that we can edit # keep only column 1 which are the newsgroup names sort newsgroups | sed -e 's/ .*//' -e 's/ .*//' | uniq >$tmpfiley #ed $tmpfiley </dev/null >/dev/null #1,\$s/ .*// #1,\$s/ .*// #w #q #EOF sort active | sed -e 's/ .*//' | uniq >$tmpfilex comm -23 $tmpfilex $tmpfiley >$act_not_news comm -13 $tmpfilex $tmpfiley >$news_not_act if [ -s $act_not_news ] then echo "The following are in active file but not in newsgroups:" cat $act_not_news fi if [ -s $news_not_act ] then echo "The following are in newsgroups file but not in active file:" cat $news_not_act fi SHAR_EOF # End of shell archive exit 0