article would not expire
Bernhard Kohl
B.Kohl at rrz.uni-koeln.de
Tue Jul 3 12:11:45 UTC 2001
Hallo Olivier,
Mitteilung vom Dienstag, 3. Juli 2001, 13:36:13:
ON> Dear Bernhard,
ON> I tried the sort by hand, the file appears to be correct.
ON> I stopped the server and did a makehistory.
ON> Then I rerun news.daily.
ON> I notices it never do the command expirerm ${EXPIRERM}
ON> I tried to run that by hand
Which parameters are given to news.daily? Here the crontab entry looks
like:
00 03 * * * /opt/news/home/bin/news.daily norm expireover delayrm lowmark
ON> But I have still that bunch of old entries in spool/article
ON> Any idea is more than welcome.
If you can trust the lowmark entry in your active file than there is a
way to purge all files that are below this value (e.g. old files).
I've done this with a perl script:
#! /bin/perl -w
use strict;
# caution: accesses active directly
# caution: removes files immediately
# adjust path to news
my $activelow = "/opt/news/db/active";
my $articlepath = "/opt/news/articles/articles/";
my ($line, $group, $highmark, $lowmark, $dirname, $file, $oldfile);
open(ACTIVE, "< $activelow") or die "Can't open $activelow:\n$!\n";
while ($line = <ACTIVE>) {
chomp($line);
($group, $highmark, $lowmark, $_) = split(" ",$line);
#if highmark 0, than there is no article
next if ($highmark == 0);
#change group name to path name
$group =~ s/\./\//g;
$dirname = $articlepath . $group;
opendir(DIR, $dirname) or die "Can't open $dirname:\n$!\n";
while (defined($file = readdir(DIR))) {
# full path required
# if (-d $file) will fail
$oldfile = $dirname . '/' . $file;
next if (-d $oldfile);
if ($file < $lowmark) {
unlink($oldfile) or die "Can't open $oldfile: $!";
print "$oldfile removed\n";
}
}
closedir(DIR);
}
close(ACTIVE);
As with all software: Use it at your own risk! And pe prepared that it
may run for a long time (depending an the amount of old files) and
that it will significantly push I/O-activity on your machine.
--
Mit freundlichen Grüßen,
Bernhard Kohl
More information about the inn-workers
mailing list