Thread View: news.software.nntp
8 messages
8 total messages
Started by Daryl E. Kottek
Thu, 16 May 1996 00:00
How do I remove stuff expire missed?
Author: Daryl E. Kottek
Date: Thu, 16 May 1996 00:00
Date: Thu, 16 May 1996 00:00
25 lines
1284 bytes
1284 bytes
I had a period of time in which fastrm was failing. Now that I have that fixed, I have some articles that should have been removed, but were not, and are not being found in the daily "news.daily" routine. I'm guessing that this is because those articles are not known in the history file. 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. Read the FAQ's, done man on expire, news.daily, and history. Thanks for your help. -Daryl Kottek dkottek@orednet.org -- ..
Re: How do I remove stuff expire missed?
Author: 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
Re: How do I remove stuff expire missed?
Author: Harry Bochner
Date: Fri, 24 May 1996 00:00
Date: Fri, 24 May 1996 00:00
20 lines
1394 bytes
1394 bytes
In article <4nfvss$h86@ednet1.orednet.org>, dkotte2@ednet1.osl.or.gov (Daryl E. Kottek) writes: |> 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. Get my findmissing.pl script from http://www.math.psu.edu/barr/INN.html (or ftp://ftp.math.psu.edu/pub/INN/contrib/findmissing.pl if you don't want to look at all the other lovely resources Dave Barr has assembled). It will give you a sorted list of the articles that are in the spool, but not in the history file. Then you can feed the list to fastrm. And it's fast, compared to the alternatives ... -- Harry Bochner bochner@das.harvard.edu
Re: How do I remove stuff expire missed?
Author: Rich Salz
Date: Sat, 25 May 1996 00:00
Date: Sat, 25 May 1996 00:00
10 lines
772 bytes
772 bytes
In <4o4r9a$8nd@twwells.com> bill@twwells.com (T. William Wells) writes: > In particular, it contains the >_lowest_ numbered article in each newsgroup that is to be in the >spool. Clever lad. /r$
Re: How do I remove stuff expire missed?
Author: Torbjorn Lindgren
Date: Sat, 01 Jun 1996 00:00
Date: Sat, 01 Jun 1996 00:00
31 lines
1686 bytes
1686 bytes
Daryl E. Kottek <dkotte2@ednet1.osl.or.gov> wrote: >I'm guessing that this is because those articles are not known in the >history file. Right. >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. Some people will of course recommend findmissing.pl, but while it does work I can't understand why they use a program that easily runs for *hours* when there are *much* faster programs available. I use newsprune when I get that kind of problems, and the difference is amazing (I haven't measured it, but it might well be two orders of magnitude or more!).. Look at http://www.backplane.org/news for a description and a pointer to the latest version (http://apollo.best.com/news/newsprune203.tar.gz) OK, actually deleting them still takes time even using fastrm, but... -- Torbj�rn Lindgren Network manager at Funcom Oslo AS E-mail: tl@funcom.com If Santa ever DID deliver presents on Christmas Eve, he's dead now.
Re: How do I remove stuff expire missed?
Author: Paul Southworth
Date: Sun, 02 Jun 1996 11:26
Date: Sun, 02 Jun 1996 11:26
233 lines
5966 bytes
5966 bytes
In article <4opca7$frd@odin.funcom.no>,
Torbjorn Lindgren <tl@odin.funcom.no> wrote:
>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.
>
>Some people will of course recommend findmissing.pl, but while it does
>work I can't understand why they use a program that easily runs for
>*hours* when there are *much* faster programs available.
I couldn't agree more.
Here's another one we've been using for a couple years. Written by
Bryan Beecher <bryan@ans.net> while he was still at the University of
Michigan. Utility is called "missart".
/*
* Copyright (c) 1994 Regents of the University of Michigan.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that this notice is preserved and that due credit is given
* to the University of Michigan at Ann Arbor. The name of the University
* may not be used to endorse or promote products derived from this
* software without specific prior written permission. This software
* is provided ``as is'' without express or implied warranty.
*/
#include <stdio.h>
#include <string.h>
#include <dirent.h>
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif
static char *article_path = "/var/spool/news";
static char *history_file = "/usr/local/news/history";
static char *newsgroups[BUFSIZ * 16];
static int number_of_groups = 0;
char *dbggrp = NULL;
main(argc, argv)
int argc;
char *argv[];
{
FILE *fp;
char line[BUFSIZ];
register char *s;
int c;
extern char *optarg;
void usage(), check_group();
while ((c = getopt(argc, argv, "a:d:h:")) != EOF)
switch(c) {
case 'a' :
article_path = optarg;
break;
case 'd' :
dbggrp = optarg;
break;
case 'h' :
history_file = optarg;
break;
default :
usage(argv[0]);
/*NOTREACHED*/
}
if ((fp = fopen(history_file, "r")) == NULL) {
perror("fopen");
exit(-1);
}
if (chdir(article_path) < 0) {
perror("chdir");
exit(-1);
}
for (;;) {
if (fgets(line, sizeof(line), fp) == NULL)
break;
line[strlen(line) - 1] = '\0'; /* kill newline */
/* message-id */
if ((s = strtok(line, " \t")) == NULL)
break;
/* time(s) */
if ((s = strtok(NULL, " \t")) == NULL)
break;
/* path(s), if not already expired */
if ((s = strtok(NULL, " \t")) == NULL)
continue;
for (;;) {
check_group(s);
/* additional paths */
if ((s = strtok(NULL, " \t")) == NULL)
break;
}
}
fclose(fp);
}
void check_group(group)
char *group;
{
void to_path(), add_to_list();
int need_to_do(), debug = 0, number, article;
int found_letter = FALSE;
char *cp;
DIR *dirp;
struct dirent *dp;
/* get group name */
cp = strchr(group, '/');
if (cp == NULL)
return;
*cp = '\0';
/* do we need to do this group, or have we done it already? */
if (!need_to_do(group))
return;
add_to_list(group);
if (dbggrp != NULL && !strcmp(group, dbggrp)) {
debug = 1;
printf("Group '%s' has been added to the list\n", group);
}
/* change the dots in the group name to slashes */
to_path(group);
/* get article number */
number = atoi (cp + 1);
if (debug > 0)
printf("First article listed in history db is %d\n", number);
if ((dirp = opendir(group)) == NULL) {
printf("Could not open directory %s\n", group);
perror("opendir");
return;
}
for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) {
if (!strcmp(dp->d_name, "."))
continue;
if (!strcmp(dp->d_name, ".."))
continue;
if ((article = atoi(dp->d_name)) == 0) /* subdirectory */
continue;
/*
* atoi() can be fooled by some subdirectories, like alt/3d
*/
for (cp = dp->d_name; *cp != '\0'; cp++)
if (!isdigit(*cp)) {
found_letter = TRUE;
break;
}
if (found_letter)
continue;
if (debug > 0) {
printf("%d ", article);
fflush(stdout);
}
if (article < number)
printf("%s/%s/%s\n", article_path, group, dp->d_name);
}
if (debug > 0)
printf("\n");
fflush(stdout);
closedir(dirp);
return;
}
void to_path(s)
char *s;
{
register char *rcp;
for (rcp = strchr(s, '.'); rcp != NULL; rcp = strchr(s, '.'))
*rcp = '/';
return;
}
void add_to_list(group)
char *group;
{
int qsortcmp();
newsgroups[number_of_groups] = strdup(group);
number_of_groups++;
qsort(newsgroups, number_of_groups, sizeof(char *), qsortcmp);
return;
}
need_to_do(group)
char *group;
{
int bsearchcmp();
if (bsearch(group, newsgroups, number_of_groups, sizeof(char *), bsearchcmp) == NULL)
return(TRUE);
return(FALSE);
}
bsearchcmp(s1, s2)
char *s1, **s2;
{
return(strcmp(s1, *s2));
}
qsortcmp(s1, s2)
char **s1, **s2;
{
return(strcmp(*s1, *s2));
}
void usage(program)
char *program;
{
fprintf(stderr, "%s [-a article-directory] [-h history-file]\n",
program);
fprintf(stderr, "Defaults are %s and %s, respectively.\n",
article_path, history_file);
exit(0);
}
Re: How do I remove stuff expire missed?
Author: Per Hedeland
Date: Mon, 03 Jun 1996 00:00
Date: Mon, 03 Jun 1996 00:00
56 lines
3289 bytes
3289 bytes
[ Bogus Distribution: inet removed ] In article <4opca7$frd@odin.funcom.no> tl@odin.funcom.no (Torbjorn Lindgren) writes: >Some people will of course recommend findmissing.pl, but while it does >work I can't understand why they use a program that easily runs for >*hours* when there are *much* faster programs available. Gee, and I thought findmissing was fast...:-) (Remember, some people still try to do this with *makehistory*!) >I use newsprune when I get that kind of problems, and the difference >is amazing (I haven't measured it, but it might well be two orders of >magnitude or more!).. I seriously doubt that - I *did* measure it: Running first newsprune and then findmissing on a lightly loaded server with 4.5GB of articles and 128 MB RAM, findmissing was 4-5 times slower, or 11:00/10:28/11:47 vs 46:42/47:38/44:32 minutes (I did it several times since there were no missing articles - had to plant some to see if newsprune would find them:-). Not a big deal as you typically don't sit around waiting for it - but of course when it's two vs nine hours you may feel differently, and with a slower CPU (this was on a Sun SS10/30 though, i.e. rather mediocre by today's standards) the difference may be bigger, since it's presumably dominated by the fact that findmissing is a perl script and newsprune a C program - they do almost exactly the same thing... There are a couple of optimizations in newsprune which you may or may not appreciate though: - It only considers articles that are outside the *range* of article numbers for each group in history as missing, i.e. articles inside the range aren't reported even if they aren't in history. No problem if you run it regularly, but one run is not enough to clean up after a crash - and where are the time savings then...? - It only scans directories corresponding to groups in active, i.e. missing articles in groups you have removed while leaving the articles (expecting expire to remove them) are never found. Might be a problem depending on your rmgroup habits. Another difference that probably doesn't affect performance is that newsprune scans history first and then spool, findmissing the other way around. This means that newsprune has to ignore "recent" (< 8 hrs old) articles as they might have been entered into history after it was scanned (normally no problem), while findmissing is in some sense more "exact" (unless it runs across an expire:-) but can't afford to descend into all-numeric directories (yeah I know, there shouldn't be any:-) - I guess newsprune has a slight advantage there. --Per Hedeland per@erix.ericsson.se
Re: How do I remove stuff expire missed?
Author: Torbjorn Lindgren
Date: Sun, 09 Jun 1996 00:00
Date: Sun, 09 Jun 1996 00:00
49 lines
2898 bytes
2898 bytes
Per Hedeland <per@erix.ericsson.se> wrote: >>I use newsprune when I get that kind of problems, and the difference >>is amazing (I haven't measured it, but it might well be two orders of >>magnitude or more!).. > >I seriously doubt that - I *did* measure it: Running first newsprune and >then findmissing on a lightly loaded server with 4.5GB of articles and >128 MB RAM, findmissing was 4-5 times slower, or 11:00/10:28/11:47 vs >46:42/47:38/44:32 minutes (I did it several times since there were no >missing articles - had to plant some to see if newsprune would find >them:-). Yes, I should have tested it instead of relying on sometimes faulty memory. This time it was faulty :-) On my machine the difference was smaller, slightly above twice as fast :-) *Neither* of the programs were CPU limited, even if newsprune did use 15 times as much user-time as newsprune did (it managed to get about 60% if you counted both user and system, compared news-prunes 11%). My machine is probably rather non-typical, most News-machines probably have more disk IO compared CPU (I have much CPU since the machine is used primarly for other things, and only one disk since it doesn't take *that* much News), so findmissing might well be CPU limited which would changed the ratio upwards. I found some old timings which gave a factor 6-7 speed difference (a dedicated news-server, with 4 disks for news-spool, and maybe 1/5 of the CPU power of *one* of the CPU's in this machine) >Not a big deal as you typically don't sit around waiting for it - but of >course when it's two vs nine hours you may feel differently, and with a >slower CPU (this was on a Sun SS10/30 though, i.e. rather mediocre by >today's standards) the difference may be bigger, since it's presumably >dominated by the fact that findmissing is a perl script and newsprune a >C program - they do almost exactly the same thing... Possibly. In my case *NONE* of the programs were CPU limited, and I still got a factor 2. In most cases findmissing will probably be CPU limited, which will tend to make the difference larger. -- Torbj�rn Lindgren Network manager at Funcom Oslo AS E-mail: tl@funcom.com If Santa ever DID deliver presents on Christmas Eve, he's dead now.
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