Path: utzoo!utgpu!watmath!clyde!att!pacbell!ames!mailrus!ncar!tank!gargoyle!jpusa1!stu From: stu@jpusa1.UUCP (Stu Heiss) Newsgroups: news.software.b Subject: Auto-expiration of news Message-ID: <1021@jpusa1.UUCP> Date: 2 Dec 88 17:01:51 GMT References: <1066@psuhcx.psu.edu> <2694@sultra.UUCP> Reply-To: stu@jpusa1.UUCP (Stu Heiss,6312,6334,) Followup-To: news.software.b Organization: JPUSA - Chicago, IL Lines: 102 Summary: Expires: In article <2694@sultra.UUCP> dtynan@sultra.UUCP (Der Tynan) writes: -From article <1066@psuhcx.psu.edu>, by wcf@psuhcx (Bill Fenner): -> -> Does anyone have a good way to expire news automatically when the news -> partition gets full? -I have a similar problem. Having given it some thought, I have come up with -a clean solution that (someday) I will implement in 2.11 (or whatever). -Anyway, the idea is this. In the NEWS/active file, a new field is introduced -in the tradition of the 'm' field for 'moderated'. It is a boolean ('y'/'n'?), -which indicates that the given newsgroup is not read at this site. In this -way, a nightly (or weekly) cron program would zip through all the .newsrc -files, to see what groups aren't subscribed to, and update the 'active' file. -On the other hand, if someone subscribes to a currently unavailable group, -the daemon would reactivate it. And vnews/readnews/whatever would inform -the reader that the group isn't currently carried, but will appear in a few -days. Of course, certain groups (such as comp.mail.maps) would have a special -mark saying that they must ALWAYS be subscribed to ('a' perhaps?). We do something similar with a couple of shell scripts and no mods to the news software - works quite nicely. I use the previously posted script (inactng.sh) to get a list of inactive (nobody reads them) newsgroups and rm the articles in the associated directories. In addition, we always junk 'junk' and never junk 'comp.mail.maps' and 'news.announce.important'. Run 'junkarts.sh' as often as necessary. In my hourly news startup and nitely expire scripts I have: /usr/lib/news/expire.sh:find $LIB/active -newer $LIB/lastjunk -exec $LIB/junkarts.sh ';' -exec touch $LIB/lastjunk ';' /usr/lib/news/rnews.sh:find $LIB/active -newer $LIB/lastjunk -exec $LIB/junkarts.sh ';' -exec touch $LIB/lastjunk ';' This way if the active file gets modified junkarts is run. Following is junkarts.sh and the utility inactng.sh. #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # /usr/lib/news/junkarts.sh # /usr/lib/news/inactng.sh # This archive created: Fri Dec 2 10:58:35 1988 # By: stu (JPUSA - Chicago, IL) export PATH; PATH=/bin:/usr/bin:$PATH echo shar: "x - '/usr/lib/news/junkarts.sh'" if test -f '/usr/lib/news/junkarts.sh' then echo shar: "will not over-write existing file '/usr/lib/news/junkarts.sh'" else cat << \SHAR_EOF/usr/lib/news/junkarts.sh > '/usr/lib/news/junkarts.sh' : PATH=/bin:/usr/bin export PATH lib=/usr/lib/news spool=/usr/spool/news tmpa=/tmp/.a$$ tmpb=/tmp/.b$$ trap 'rm -f $tmpa $tmpb;exit' 0 1 2 3 15 junkalways=false cd $spool $lib/inactng.sh|tr . /|grep -v comp/mail/maps|grep -v news/announce/important > $tmpa cat -s $tmpa|while read d do test -d $d && ls $d|sed "s;^;$d/;" done|while read f do test -f $f && echo $f done > $tmpb $junkalways && find junk -type f -print >> $tmpb xargs < $tmpb rm -f $f SHAR_EOF/usr/lib/news/junkarts.sh if test 452 -ne "`wc -c < '/usr/lib/news/junkarts.sh'`" then echo shar: "error transmitting '/usr/lib/news/junkarts.sh'" '(should have been 452 characters)' fi chmod +x '/usr/lib/news/junkarts.sh' fi echo shar: "x - '/usr/lib/news/inactng.sh'" if test -f '/usr/lib/news/inactng.sh' then echo shar: "will not over-write existing file '/usr/lib/news/inactng.sh'" else cat << \SHAR_EOF/usr/lib/news/inactng.sh > '/usr/lib/news/inactng.sh' : ng1=/tmp/ng1$$ ng2=/tmp/ng2$$ trap 'rm -f $ng1 $ng2;exit' 0 1 2 3 15 ACTIVE=/usr/lib/news/active cat `sed 's;[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\):.*;\1/.newsrc;' /etc/passwd` 2> /dev/null \ | sed -n 's/\([^:]*\):.*$/\1/p' |sort |uniq > $ng1 sed 's/ .*//' $ACTIVE |sort > $ng2 diff $ng1 $ng2 | sed -n 's/^> //p' SHAR_EOF/usr/lib/news/inactng.sh if test 476 -ne "`wc -c < '/usr/lib/news/inactng.sh'`" then echo shar: "error transmitting '/usr/lib/news/inactng.sh'" '(should have been 476 characters)' fi chmod +x '/usr/lib/news/inactng.sh' fi exit 0 # End of shell archive -- Stu Heiss {spl1,uchicago.edu!gargoyle,ddsw1}!jpusa1!stu