home *** CD-ROM | disk | FTP | other *** search
- From: nik@st_nik!swindon.ingr.com (Nik Simpson x4333)
- Newsgroups: alt.sources
- Subject: Re: Newjunk: scanning the junk directory for new groups
- Message-ID: <1991Feb16.142137.22726@st_nik!swindon.ingr.com>
- Date: 16 Feb 91 14:21:37 GMT
-
-
- Funny how people do the same thing in different ways, I'm lazy, I
- wrote my checkjunk as script. It checks each article in the junk directory
- for Newsgroup lines and Approved lines. New newsgroups that have an Approved
- line are created moderated. Only thos groups in the hierarchies given in the
- "ok" variable are created. This is written for CNEWS, but the changes for
- BNEWS should be minimal. On the nodes I administer this script runs every night
- and the output generated is part of the daily report.
-
- -----------------------------------cut here--------------------------------
-
- # This script checks the Newsgroups lines in the articles in the junk
- # directory, if the newgroup is not in active, a local newgroup message
- # is created. If the article contains an approved line then we assume that
- # the newsgroup should be created moderated, otherwise it will be unmoderated.
- #
- ok="comp sci talk misc rec ingr ingreur ingruk general comp control eunet soc
- vmsnet gnu unix-pc alt"
- . ${NEWSCONFIG-/usr/lib/news/bin/config}
- PATH=$PATH:${NEWSCTL}/bin/maint
- cd ${NEWSARTS}/junk
- USER=checkjunk
- export USER
- ls * >/dev/null 2>&1
- if [ $? -ne 0 ]
- then
- echo "No file in junk directory"
- exit 0
- fi
- for file in *
- do
- grep "^Newsgroups:" $file|sort|uniq|cut -f2 -d":"|sed "s/,.*//g"|
- while read line
- do
- grep "$line" ${NEWSCTL}/active>/dev/null
- if [ $? -ne 0 ]
- then
- grep "^Approved:" $file >/dev/null 2>&1
- if [ $? -eq 0 ]
- then
- flags=m
- message="Moderated"
- else
- flags=y
- message="Unmoderated"
- fi
- grp=`echo $line|sed "s/\..*//g"`
- OK=1
- set "" $ok
- while [ $OK -eq 1 ]
- do
- if [ "$1" = "$grp" ]
- then
- OK=0
- else
- shift
- if [ "$1" = "" ]
- then
- break
- fi
- fi
- done
- if [ $OK -eq 0 ]
- then
- echo adding $line $message
- addgroup $line $flags </dev/null
- else
- echo "Will not add $line"
- fi
- else
- echo "$line ok"
- fi
- done
- done |sort|uniq
- -------------------------------------------------------------------------------
- --
- |--------------------------------------------------|
- | Nik Simpson UUCP :uunet!ingr!swindon!st_nik!nik|
- | Systems Consultant (UNIX). Intergraph UK Ltd. |
- |--------------------------------------------------|
-