Thread View: news.software.nntp
3 messages
3 total messages
Started by Robert S. Liesenfeld
Sat, 16 Nov 1996 00:00
Merging newsgroups & active..?
Author: Robert S. Liesenfeld
Date: Sat, 16 Nov 1996 00:00
Date: Sat, 16 Nov 1996 00:00
25 lines
1597 bytes
1597 bytes
Hi there. I'm the poor schmuck who's stuck with maintaining INN at our site; we get news feeds from two different places, and we have a couple of local newsgroups. Both of our newsfeeds just added (doubled, actually) some newsgroups. I am now assigned the task of merging the actives and newsgroups from visi.com and mr.net with our own. What's the best way to do this? I've already tried a hopeless attempt involving cat, sort, uniq, and pipes...=] Please help! Please reply via email to xunil@bitstream.net; any and all help is appreciated. Thanks in advance! -R ----------------------------------------------------------------------- Robert S. Liesenfeld <>< | Mail/News/UUCP Administrator xunil@bitstream.net IRC:Xunil | Programmer http://www2.bitstream.net/~xunil/ | Network Engineer finger for PGP public key | Die-hard Linux Addict "Fnord." | Bitstream Underground, Mpls, MN
Re: Merging newsgroups & active..?
Author: James Brister
Date: Sat, 16 Nov 1996 00:00
Date: Sat, 16 Nov 1996 00:00
21 lines
1265 bytes
1265 bytes
"Robert S. Liesenfeld" <xunil@bitstream.net> writes: > I am now assigned the task of merging the actives and > newsgroups from visi.com and mr.net with our own. What's the best way to > do this? I've already tried a hopeless attempt involving cat, sort, uniq, > and pipes...=] Please help! actsync is a great tool for merging active files. It's in the 1.5b2 distribution. ftp://ftp.vix.com/pub/inn/inn-1.5b2.tar.gz Landon Curt Noll <noll@sgi.com> wrote it and distributes it separately too. James -- James Brister brister@vix.com Internet Software Consortium http://www.isc.org inn@isc.org
Re: Merging newsgroups & active..?
Author: Mail account for root
Date: Sun, 17 Nov 1996 00:00
Date: Sun, 17 Nov 1996 00:00
237 lines
8586 bytes
8586 bytes
Robert S. Liesenfeld <xunil@bitstream.net> wrote:
: Hi there.
: I'm the poor schmuck who's stuck with maintaining INN at our site; we get
: news feeds from two different places, and we have a couple of local
: newsgroups. Both of our newsfeeds just added (doubled, actually) some
: newsgroups. I am now assigned the task of merging the actives and
: newsgroups from visi.com and mr.net with our own. What's the best way to
: do this? I've already tried a hopeless attempt involving cat, sort, uniq,
: and pipes...=] Please help!
: Please reply via email to xunil@bitstream.net; any and all help is
: appreciated. Thanks in advance!
: -R
: -----------------------------------------------------------------------
: Robert S. Liesenfeld <>< | Mail/News/UUCP Administrator
: xunil@bitstream.net IRC:Xunil | Programmer
: http://www2.bitstream.net/~xunil/ | Network Engineer
: finger for PGP public key | Die-hard Linux Addict
: "Fnord." | Bitstream Underground, Mpls, MN
Here is what I use (feel free to adapt it in any way you want, the script
and the new "active" and "newsgroups" must in in a subdirectory of ~news):
#!/usr/bin/perl
#
# @(#) merge.pl - Merge either active or newsgroups
# The newest files can be obtained from ftp://ftp.uu.net/news/config
#
# (c) Copyright 1996 Thomas Bullinger
#
# 1.00 21-May-1996 TB First version
# 1.10 22-May-1996 TB Added newsgroups
# 1.11 27-Oct-1996 TB Allow serial -a and -n
# Constants
($ProgName = $0) =~ s%.*/%%;
$Version = "1.11 (27-Oct-1996)";
$CopyRight = "(c) Copyright 1996 Thomas Bullinger";
# Some programs
$Copy = "/bin/cp";
$ChOwn = "/bin/chown";
$CtlInnd = "../bin/ctlinnd";
# The files we work on
$ActiveNow = "../active";
$ActiveNew = "./active";
$SortedActive = "./active.sorted";
$SortedActiveNew = "./active.new";
$NGNow = "../newsgroups";
$NGNew = "./newsgroups";
$SortedNG = "./newsgroups.sorted";
$SortedNGNew = "./newsgroups.new";
require 'getopts.pl';
###########################################################
# Display the usage
###########################################################
sub ShowUsage {
print "Usage: $ProgName [options]\n",
" -a Process \"active\"\n",
" -n Process \"newsgroups\"\n",
" -v Be verbose\n",
" -h Show this help\n";
exit 0;
} # end ShowUsage
###########################################################
# Main function
###########################################################
print ("$ProgName, Version $Version\n$CopyRight\n\n");
# Get possible options
&Getopts ('anhv') || &ShowUsage;
&ShowUsage if (($opt_h) || ((! $opt_a) && (! $opt_n)));
# Make stdout unbuffered
$| = 1;
if ($opt_a) {
# Open a connection to the sort program
open (ST, "| sort -u > $SortedActive") || die "ERROR: Can not find sort\n";
print "Sorting active.\n" if ($opt_v);
# Get the current active file
open (AF, "$ActiveNow") || die "ERROR: $ActiveNow not found\n";
print "Reading \"$ActiveNow\"..." if ($opt_v);
while ($Entry = <AF>) {
($NewsGroup, $MinE, $MaxE, $NFlag) = split (/ /, $Entry);
chomp ($CurrentActive{$NewsGroup} = "$MinE $MaxE $NFlag");
print ST "$NewsGroup\n";
}
close (AF);
print " done.\n" if ($opt_v);
# Get the new active file
open (AF, "$ActiveNew") || die "ERROR: $ActiveNew not found\n";
print "Reading \"$ActiveNew\"..." if ($opt_v);
while ($Entry = <AF>) {
($NewsGroup, $MinE, $MaxE, $NFlag) = split (/ /, $Entry);
chomp ($NewActive{$NewsGroup} = "$MinE $MaxE $NFlag");
print ST "$NewsGroup\n";
}
close (AF);
print " done.\n" if ($opt_v);
close (ST);
print "Sorting done.\n" if ($opt_v);
# Get the sorted active file
open (AF, "$SortedActive") || die "ERROR: $SortedActive not found\n";
open (SN, "> $SortedActiveNew") || die "ERROR: Can not create $SortedActiveNew\n";
print "Transforming \"$SortedActive\" to \"$SortedActiveNew\".\n" if ($opt_v);
$EntryNum = 0;
while ($Entry = <AF>) {
chomp ($Entry);
print "Newsgroup: $Entry\n" if ($opt_v);
# Is the entry in the current active ?
if ( $CurrentActive{$Entry}) {
# Yes -> keep it
print SN "$Entry $CurrentActive{$Entry}\n";
} else {
# No -> Keep the new one
print SN "$Entry $NewActive{$Entry}\n";
}
$EntryNum++;
} # end while
close (AF);
close (SN);
unlink ($SortedActive);
print "Transformation done ($EntryNum entries).\n" if ($opt_v);
# Reload the active file
print "Reloading updated active..." if (opt_v);
system ("$CtlInnd pause Reloading active");
system ("$Copy $SortedActiveNew $ActiveNow");
system ("$ChOwn news.news $ActiveNow");
system ("$CtlInnd reload active Upgraded by $ProgName");
system ("$CtlInnd go Reloading active");
print "Current server status:\n";
system ("$CtlInnd mode");
print " done.\n" if ($opt_v);
# Some parting words
print "\nIf everything went okay you may delete the following file:\n",
"$SortedActiveNew\n";
}
if ($opt_n) {
# Open a connection to the sort program
open (ST, "| sort -u > $SortedNG") || die "ERROR: Can not find sort\n";
print "Sorting newsgroups.\n" if ($opt_v);
# Get the current active file
open (AF, "$NGNow") || die "ERROR: $NGNow not found\n";
print "Reading \"$NGNow\"..." if ($opt_v);
while ($Entry = <AF>) {
($NewsGroup, $Desc) = split (/\t+/, $Entry);
chomp ($CurrentNG{$NewsGroup} = "$Desc");
print ST "$NewsGroup\n";
}
close (AF);
print " done.\n" if ($opt_v);
# Get the new active file
open (AF, "$NGNew") || die "ERROR: $NGNew not found\n";
print "Reading \"$NGNew\"..." if ($opt_v);
while ($Entry = <AF>) {
($NewsGroup, $Desc) = split (/\t+ /, $Entry);
chomp ($NewNG{$NewsGroup} = "$Desc");
print ST "$NewsGroup\n";
}
close (AF);
print " done.\n" if ($opt_v);
close (ST);
print "Sorting done.\n" if ($opt_v);
# Get the sorted active file
open (AF, "$SortedNG") || die "ERROR: $SortedNG not found\n";
open (SN, "> $SortedNGNew") || die "ERROR: Can not create $SortedNGNew\n";
print "Transforming \"$SortedNG\" to \"$SortedNGNew\".\n" if ($opt_v);
$EntryNum = 0;
while ($Entry = <AF>) {
chomp ($Entry);
print "Newsgroup: $Entry\n" if ($opt_v);
# Is the entry in the current active ?
if ( $CurrentNG{$Entry}) {
# Yes -> keep it
print SN "$Entry $CurrentNG{$Entry}\n";
} else {
# No -> Keep the new one
print SN "$Entry $NewNG{$Entry}\n";
}
$EntryNum++;
} # end while
close (AF);
close (SN);
unlink ($SortedNG);
print "Transformation done ($EntryNum entries).\n" if ($opt_v);
# Reload the active file
print "Reloading updated newsgroups..." if (opt_v);
system ("$Copy $SortedNGNew $NGNow");
system ("$ChOwn news.news $NGNow");
print "Current server status:\n";
system ("$CtlInnd mode");
print " done.\n" if ($opt_v);
# Some parting words
print "\nIf everything went okay you may delete the following file:\n",
"$SortedNGNew\n";
}
exit 0;
--______ __ ---------------------------------------------------------
' / '/ ) Thomas Bullinger
/ /--< This is the mail account for root@btoy1.rochester.ny.us
(_/ /___/ http://btoy1-gw.roc.servtech.com/index.phtml
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