earlw@pesnta.UUCP (Earl Wallace) (08/10/84)
<mealtime for bonzo> Here is a little script that may solve some your netnews spool directory space problems. I found that my expire program wasn't expiring all my news articles (imagine that?) and I didn't have the time to work on expire and correct the bugs so I created a simple sh script to at least remove articles in the netnews spool directory that netnews no longer knows about (those articles not in the history database files). I got back some disk space that made it quite worth the effort. Don't run this buzzard unless your news system is quiescent or you will run the risk of losing some articles. With the 2.10.2 expire program on its way, this script may not be needed (save it for a rainy day... he-he-he...). --------------- cut here ------------------- : ' synchist [pesnta!earlw] This sh script will delete files in the netnews spool directory that are missing from the history database file. ' LIB=/usr/lib/news : ' netnews library ' SPL=/netnews : ' netnews spool directory ' USR=usenet : ' netnews admin user ' TMP=/tmp : ' some place to put the temp files ' RM="rm -f" : ' RM="echo" for chickens, RM="rm -f" for tough guys ' : ' history file articles are separated by newlines and sorted ' awk ' \ BEGIN { FS = "\t" } \ { if($3) printf "%s ", $3 } \ END { printf "\n" } \ ' ${LIB}/history | tr -s ' ' '\012' | sed "s/\./\//g" | \ sort -u > ${TMP}/history.sync : ' find and sort all news articles found in the news spool directory ' (cd ${SPL}; \ find . -type f -print | sed "s/^\.\///" | sort -u > ${TMP}/netnews.sync) : ' find articles in the news spool directory that are not in the history file ' comm -23 ${TMP}/netnews.sync ${TMP}/history.sync | \ sed s"/.*/${RM} \/netnews\/&/" > ${TMP}/delete.sync : ' files found in the news spool directory but not in the history database are elected to face the remove command! let the usenet person know whats going on (at least a little...) ' NUMBER=`wc -l ${TMP}/delete.sync | awk '{print $1}'` if test ${NUMBER} != 0 then (cd /netnews; /bin/sh ${TMP}/delete.sync) mail ${USR} <<EATIT Report from synchist: Articles deleted from the /netnews directory: ${NUMBER} The articles deleted did not exist in the history database. EATIT fi : ' remove the tmp files like a good little program... ' ${RM} ${TMP}/delete.sync ${TMP}/history.sync ${TMP}/netnews.sync ------------------ cut here -------------------- -- Earl Wallace UUCP: ..!{ihnp4, ucbvax!hplabs, ucbvax!twg}!pesnta!earlw PHONE: (408) 727-5540 x230 USMAIL: Perkin-Elmer Corp., Santa Clara, Calif. 95054