🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
3 messages
3 total messages Started by Martin G. Rathmayer Fri, 05 Dec 1997 00:00
Adding entries to history
#24075
Author: Martin G. Rathmayer
Date: Fri, 05 Dec 1997 00:00
14 lines
1070 bytes
Has anybody a script to add a list of article files to the existing
history database ?

MGR
-- 
MARTIN G. RATHMAYER                       Email: rathmayer@edvz.tuwien.ac.at
Member of Communications Group            Phone: (++43-1 58801-5834)
Computing Services                        FAX:   (++43-1 587 42 11)
Technical University of Vienna, Wiedner Hauptstr. 8-10, A-1040 Vienna/AUSTRIA
    PGP Public-Key: ftp://nic.tuwien.ac.at/netinfo/info/kom-pubring.pgp
    PGP Finger-Print: 91 8A 7F 2C 97 66 1A 4E 56 68 0F 57 FF 33 A9 A3 

Re: Adding entries to history
#24036
Author: Chris van den Berg
Date: Fri, 05 Dec 1997 00:00
152 lines
5151 bytes
Martin G. Rathmayer wrote:
> 
> Has anybody a script to add a list of article files to the existing
> history database ?

Hi,

Below is a script called addhist.pl, which takes a list of articles
names
relative to the spool directory and creates 'ctlinnd addhist' commands.
I've still got some work to do with it, like not creating multiple
addhist
commands for crossposted articles (although it still handles the "paths"
part of the addhist command just fine).  This doesn't cause any
problems, it 
just creates extra addhist commands which end up getting rejected by
innd
as duplicates.
I ran it over a list of a few thousand articles in a pretty short time
(five minutes?).
The addhist commands themselves will take longer.  I dunno if this is
the
fastest way to do this with innd, so if anyone has any ideas, lemme
know.
I typically use the output of "findmissing" as the input for this prog.

You can also get it at:

ftp://agate.berkeley.edu/pub/usenet/addhist.pl

It's still not perfect, so let me know if you have any suggestions.

Chris

-- 
Chris van den Berg
Programmer/Analyst
Communication and Network Services
(510)643-9837 chrisvdb@ack.berkeley.edu
Key fingerprint =  8B 52 10 58 96 40 E8 9A  EA 4B E9 27 F2 29 1A A8


------Begin addhist.pl--------

#!/usr/local/bin/perl5.00401

#Written by Chris van den Berg (chrisvdb@ack.berkeley.edu).  If you want
#to redistribute this, that's fine, just make sure to include the
#instructions.

#This script is intended to take a list of articles with pathnames
relative
#to the spool directory, and create output of ctlinnd addhist commands
#with the appropriate parameters.  It can be used as part of a pipeline
#with "findmissing"
#e.g.   % findmissing | addhist.pl | /bin/sh
#I recommend inspecting the output of findmissing and addhist.pl first,
#rather than just sending the commands onto the shell.

#This script scans the article for a message-ID, and then for a set of
#newsgroups to which it has been crossposted based on the "Xref:"
header.
#Articles which are no longer found are logged to STDERR, and no addhist
#commands are generated.

#The pathnames to the spool and news bin should be set below, as well
#as the arrival, expiration, and posted time.  This is the number of
#seconds since the epoch.
#See man ctlinnd(8) for more info.
#You also need to set $hostinoverview as the host field in the Xref:
header.
#e.g. on agate we have "Xref: agate ucb.org.foo:666", so $hostinoverview
#is set to 'agate'.

$spool='/var/spool/news/';
$ctlinnd='/usr/local/news/bin/ctlinnd';
$addhist='addhist';
$arr='44';
$exp='55';
$post='66';
$hostinoverview='agate';

#Read in a list of article pathnames relative to the spool directory.
#Get the Message-ID and the list of Newsgroups.

&getartname;

        #loop through the list of article files

sub getartname {
        while (<>) {
                $artfile="$spool"."$_";
                &scan;
        }
        close(ARTFILE);
        exit 0;
}

sub scan {
        $paths="";
        open(ARTFILE,"$artfile") || &notfound;
        while (<ARTFILE>) {

                #Find the Xref: header, but ignore the hostname between
it
                #and the start of the list of newgroups.

                if (/Xref:\s+$hostinoverview\s+/) { 
                #if (/Xref:\s+\w+\s+/) { 
                        @crossposts=split(' ',$');
                        &makecrosses;
                }
                if (/Message-ID:\s+/) {
                        $id=$';
                        chomp $id;
                }
                #Read until the end of the header, then generate the
command.
                &printadd if /^$/;
        }
}

sub printadd {
        $paths =~ s/ $//;       #get rid of the trailing space, if any.
        print "$ctlinnd $addhist \'$id\' $arr $exp $post \"$paths\"\n";
        &getartname;    #return to the top
}

        #make a list of paths for the crossposts.

sub makecrosses {
        foreach (@crossposts) {
                s/\./\//g;
                s/:/\//g;
                $paths .= $_;
                $paths .= " " if $#crossposts;
        }
}

        #print to STDERR if the article was expired since findmissing
was run.

sub notfound {
        chomp $artfile;
        print STDERR "$artfile not found, deleted?\n";
        &getartname;    #return to the top
}

-------End addhist.pl----------

Re: Adding entries to history
#24073
Author: Forrest J. Cavalier III
Date: Fri, 05 Dec 1997 00:00
54 lines
2375 bytes
In article <34883FF8.794BDF32@ack.berkeley.edu>, chrisvdb@ack.berkeley.edu 
wrote...
>
>Martin G. Rathmayer wrote:
>> 
>> Has anybody a script to add a list of article files to the existing
>> history database ?
>
>Hi,
>
>Below is a script called addhist.pl, which takes a list of articles
>names
>relative to the spool directory and creates 'ctlinnd addhist' commands.
>I've still got some work to do with it, like not creating multiple
>addhist
>commands for crossposted articles (although it still handles the "paths"
>part of the addhist command just fine).  This doesn't cause any
>problems, it 
>just creates extra addhist commands which end up getting rejected by
>innd
>as duplicates.
>I ran it over a list of a few thousand articles in a pretty short time
>(five minutes?).
>The addhist commands themselves will take longer.  I dunno if this is
>the
>fastest way to do this with innd, so if anyone has any ideas, lemme
>know.
>I typically use the output of "findmissing" as the input for this prog.
>
>You can also get it at:
>
>ftp://agate.berkeley.edu/pub/usenet/addhist.pl

That URL doesn't work for me.....

>
>It's still not perfect, so let me know if you have any suggestions.


"addmissing.pl" from the unoff-contrib at the ISC, listed on
the Usenet RKT page: News Utilities by Topic: Data Files/History
    http://www.mibsoftware.com/userkt/inn/0327.htm

does something pretty similar.  How is your addhist.pl different?
Is it an improvement?  Fewer bugs, more bugs?

Forrest Cavalier, Mib Software, INN customization and consulting 
Searchable hypertext INN docs, FAQ, RFCs, etc: 650+ pages: 
    http://www.mibsoftware.com/userkt/forprov.htm 
Commercial support for INN: http://www.mibsoftware.com/innsup.htm 


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