Thread View: news.software.nntp
3 messages
3 total messages
Started by Paul Schaller
Mon, 11 Mar 1996 00:00
(Q) History and findmissing.pl
Author: Paul Schaller
Date: Mon, 11 Mar 1996 00:00
Date: Mon, 11 Mar 1996 00:00
24 lines
1430 bytes
1430 bytes
In using findmissing.pl it appears that there are a TON of articles that don't appear in the history file. Now I know they post thru this group saying "Don't run makehistory" that is will possibly cause you to get duplicate files. Well in a situation like this what else can you do? You don't want to scrap everything you currently have and start all over waiting for articles to fill the groups. So what I am looking for is maybe a script that uses findmissing.pl and either removes these files after finding them, or better yet, adds them to the history database. Does such a script/utility exist? or Should I just remove the current history and go from there? Build a new history file and let expire remove these articles? Will expire remove these old Feb. articles and when? I started removing articles by hand but just so many of them to do. TIA, Paul
Re: (Q) History and findmissing.pl
Author: Harry Bochner
Date: Mon, 11 Mar 1996 00:00
Date: Mon, 11 Mar 1996 00:00
34 lines
1893 bytes
1893 bytes
In article <4i1od8$hls@flood.xnet.com>, paul@cnsnet.com(Paul Schaller) writes: |> So what I am looking for is |> maybe a script that uses findmissing.pl and either removes these files |> after finding them, Assuming you use delayrm, and therefore have expirerm configured to give fastrm the right options for your configuration, this should work nicely: expirerm [fullpathname to list of missing files] 'xargs rm', will work too, as Dave Barr suggests, but if there are lots of missing files, expirerm will be faster. Same for "perl -ne 'chop; unlink'". (Note that findmissing produces a list that is already sorted, suitable for feeding into expirerm ;-) Just remember that expirerm needs a full pathname, since it cd's before it opens the input file. |> or better yet, adds them to the history database. That's on my agenda, but I don't know when/if I'll get to it. Haven't needed it desparately yet ;-) |> Should I just remove the current history and go from there? Build |> a new history file and let expire remove these articles? The only problem with this approach is that on a big system makeistory takes a _long_ time. We're trying to minimize your downtime, and thereby the complaints from users ;-) -- Harry Bochner bochner@das.harvard.edu
Re: (Q) History and findmissing.pl
Author: Jacob Martin Bohn Lorensen
Date: Mon, 18 Mar 1996 00:00
Date: Mon, 18 Mar 1996 00:00
131 lines
4375 bytes
4375 bytes
-----BEGIN PGP SIGNED MESSAGE-----
>>>>> "Paul" == Paul Schaller <paul@cnsnet.com> writes:
In article <4i1od8$hls@flood.xnet.com> paul@cnsnet.com(Paul Schaller) writes:
Paul> In using findmissing.pl it appears that there are a TON of
Paul> articles that don't appear in the history file.
Paul> So what I am
Paul> looking for is maybe a script that uses findmissing.pl and
Paul> either removes these files after finding them, or better yet,
Paul> adds them to the history database.
What I do is run findmissing, then pipe the output to a little perl
script that produces a series of shell commands that would add the
missing articles to the history file. I then feed these commands to
the shell:
findmissing.pl | addmissing.pl
gives a list of shell commands on the form
ctlinnd addhist '<msg-id>' <arrive-time> <expire-time> <paths>
Usually I just mail this to myself, so that I can control what would
be done, but I might as well just feed the output to the shell
directly - just haven't gotten round to do that yet.
Paul> Does such a script/utility exist?
Well, here is my addmissing.pl. No warranty, no nothing, it just seems
to work for me.
Hope this helps,
Jacob.
#!/usr/local/bin/perl
#
# Read stdin lines of the form
# some/news/group/1234
# and add each article listed to the history file using
# ctlinnd addhist .........
#
# Posting date comes from Date: header
# Expire date comes from Expire: header (if present)
# Arrival date comes from Date: header + 2 hours :-(
# Paths comes from Xref: header.
#
$NEWSSPOOL="/usr/spool/news";
$CONVDATE="/usr/lib/news/bin/convdate";
$DEFAULT_DELIVERY_TIME=2*60*60; # seconds
$CTLINND="/usr/lib/news/bin/ctlinnd";
chdir $NEWSSPOOL;
print "## To add any articles found in the news spool and not in\n";
print "## The history files, feed the following lines to your shell\n";
print "\n";
while (<>) {
chop;
($msg_id, $expire_date, $posted_date, $paths) =
&parse_article($_);
next if ($msg_id eq "ERROR"); # File might have gone
next if defined($articles{$msg_id}); # Process each msg-id once only!
$articles{$msg_id} = 1;
if ($expire_date != "") {
$expire_time = &convdate($expire_date);
} else {
$expire_time = 0;
}
$posted_time = &convdate($posted_date);
$arrive_time = $posted_time + $DEFAULT_DELIVERY_TIME;
print "$CTLINND addhist '$msg_id' " .
"$arrive_time " .
"$expire_time " .
"$posted_time " .
"'$paths'" . "\n";
}
exit 0;
#
# Convert date
sub convdate {
local($date) = @_;
open (CONVDATE, $CONVDATE . " -n " . "'$date'" . "|") ||
die "Cannot exec $CONVDATE";
$cd = <CONVDATE>; chop($cd);
close CONVDATE;
return $cd;
}
sub parse_article {
local($art) = @_;
# We only want to process real articles. No dirs or...
(-f $art && open(ART, $art)) || return ("ERROR");
$expire = "";
$paths = $art;
while (<ART>) {
chop;
last if $_ eq "";
/^Message-ID: (<.*>)/ && ($id = $1);
/^Date: (.*)$/ && ($posted = $1);
/^Expires: (.*)$/ && ($expire = $1);
/^Xref: diku.dk (.*)$/ &&
($paths = $1) &&
($paths =~ s![.:]!/!g);
}
close(ART);
return ($id, $expire, $posted, $paths);
}
-----BEGIN PGP SIGNATURE-----
Version: 2.6.2i
iQB1AwUBMU1e/XeWVRfpQLhVAQFKzAL/cVSibSvwoT9wHBxIz0BP1SxLlhooG8tJ
M6Uxx6cWQhQDzpM11RZMVJ4v4WqZBeRbooZ9mjFS11EU5xJiaTAlzwivuAqmtfqc
80ebdo3IXOI8Bk1LoJ7TXNOxrNJh/upp
=aAV1
-----END PGP SIGNATURE-----
--
PGP Key fingerprint = E8 29 D6 EE 25 77 2E B3 17 19 1D FB E9 B2 36 A8
PGP Public key on my home page: <URL:http://www.diku.dk/~jablo/>
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