🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
2 messages
2 total messages Started by Jack Bryans Sun, 28 May 2000 00:00
batchpurge.pl, an alternative to innxmit -p
#46629
Author: Jack Bryans
Date: Sun, 28 May 2000 00:00
63 lines
2295 bytes
Using innxmit -p to purge a batchfile of entries that refer to files
that no longer exist took a couple of hours on batchfiles around 200K
lines, time better spent slogging thru the batch.  I tried a different
approach in perl that knocked the hours down to minutes.

Batchpurge.pl discards article numbers below their min in the active
file.  It catches nearly all routinely expired articles (an honored
Expires header can cause exceptions), but doesn't catch canceled
articles.  For old batches, it catches the vast majority of missing
articles.

It recognizes by content innfeed .input and .output files and does the
right thing.  Its output is to stdout so you can use redirection to
stash it anywhere, or, better yet, pipe it thru a sort to improve
efficiency at both ends.

There are three lines to edit in the beginning to adapt to your setup.

#!/usr/local/bin/perl

# Edit the next 3 assignments for your newspool path, the path to your
# active file, and one or more | joined local hierarchies not sent
# offsite.  The exclusions are groups with j, x, or = flags, in addition
# to the local hierarchy

$spool = '/var/spool/news' ;

$active = '/usr/local/news/active' ;

$exclude = '^local|=|[jx]$';

open(BATCH,$ARGV[0]) || die "Can't open $ARGV[0]";

open(ACTIVE,"egrep -v '$exclude' $active |") || die "Can't open $active";

while (<ACTIVE>) {
    ($grp,$max,$min,$flg) = split;
    $ng{$grp} = $min;
}

close ACTIVE;

chdir($spool) || die "Can't cd $spool";

$_ = <BATCH>;

$offset = /^(\d+)\s*$/ ? $1 : 0;

seek(BATCH,$offset,0);

while (<BATCH>) {
    ($art,$rest) = split;
    @grp = split(/\//,$art);
    $art = pop @grp;
    $grp = join('.',@grp);
    print unless $art < $ng{$grp};
}

close BATCH;

Jack

Re: batchpurge.pl, an alternative to innxmit -p
#47001
Author: Russ Allbery
Date: Tue, 20 Jun 2000 00:00
13 lines
1141 bytes
Jack Bryans <jbryans@swift.csulb.edu> writes:

> Using innxmit -p to purge a batchfile of entries that refer to files
> that no longer exist took a couple of hours on batchfiles around 200K
> lines, time better spent slogging thru the batch.  I tried a different
> approach in perl that knocked the hours down to minutes.

Thanks; I've added this to INN's contrib directory.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads