Article View: news.software.nntp
Article #7929Re: How do I remove stuff expire missed?
From: T. William Wells
Date: Fri, 24 May 1996 00:00
Date: Fri, 24 May 1996 00:00
66 lines
2392 bytes
2392 bytes
In article <4nfvss$h86@ednet1.orednet.org>,
Daryl E. Kottek <dkotte2@ednet1.osl.or.gov> wrote:
: Anyone know how I can remove those old articles that history doesn't
: know about? I know that I could use "find", finding all files that
: were older than 5/14, but that doesn't seem like the right thing to
: do.
That's the easiest way but can get rid of articles with explicit
Expires headers.
I used to do it by doing a find piped to sort, then extracting the
pathnames from the history file, and deleting those that didn't
exist. (Comm is a most useful tool.) This takes awhile and
involves sorting some really huge files.
I found a better way. The history file contains each article that
is supposed to be in the spool. In particular, it contains the
_lowest_ numbered article in each newsgroup that is to be in the
spool. Even better, unless you're doing really weird things, the
first time that a newsgroup is mentioned in the history the lowest
numbered article is the one found. This method has the drawback
that if an article is not in the history but is after the minimum
value, it won't get deleted. If you run this periodically, that
won't be a problem....
Anyway, here is code.
#! /bin/sh
ACTIVE=/home/news/lib/active
HISTORY=/home/news/lib/history
SPOOL=/home/news/spool
awk '{
for (i = 3; i <= NF; ++i) {
ng = $i
sub(/\/.*/, "", ng)
if (!(ng in Min)) {
art = $i
sub(/.*\//, "", art)
Min[ng] = art
gsub(/\./, "/", ng)
print ng, art
}
}
}
END {
while (getline <"'$ACTIVE'" >0) {
if ($1 in Min) {
continue
}
if ($4 == "y" || $4 == "m" || $4 == "x") {
gsub(/\./, "/", $1)
print $1, $3
}
}
}' $HISTORY |
while read name minval; do
ls -1f $SPOOL/$name |
awk '$0 < '$minval' && /^[0-9]*$/ { print "'$name'/" $0 }'
done
exit
Technical Details
Message-ID:
<4o4r9a$8nd@twwells.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mailReferences:
<4nfvss$h86@ednet1.orednet.org>Show Full Headers
Complete Article Headers
Message-ID: <4o4r9a$8nd@twwells.com> Subject: Re: How do I remove stuff expire missed? Date: Fri, 24 May 1996 00:00:00 +0000 From: bill@twwells.com (T. William Wells) References: <4nfvss$h86@ednet1.orednet.org> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail X-Deja-AN: 156556159 Organization: None, Mt. Laurel, NJ Newsgroups: news.software.nntp