🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
1 messages
1 total messages Started by Iain Lea Fri, 24 May 1996 00:00
suck + suckit.pl for microsoft.* groups
#7951
Author: Iain Lea
Date: Fri, 24 May 1996 00:00
132 lines
3139 bytes
After using Suck 2.6.3 to pull the microsoft.* groups onto our server
and finding that we were getting broken connections due to timeouts I
whipped up this little script to cycle thru the newsrc file to read
only 3 (settable via $NumGroups) groups, download them, feed them to 
rnews and then goto next 3 groups in the list.  

Works here... YMMV.

Iain

--snip--
#!/usr/local/bin/perl
#
# Harness to get MS newsgroups via *overloaded* connections
#
# Run from cron as needed

#
# Change variables to suit your site
#

$NumGroups = 3;

$FeedName = "msnews.microsoft.com";
$RnewsDir = "/usr/local/news/bin";
$SuckDir = "/usr/local/news/suck";
$BatchDir = "/news/in.coming";

#
# Don't change anything below here!
#

$Newsrc = "sucknewsrc$FeedName";
$BatchFile = "$BatchDir/$FeedName";

$SuckFlags = "-a -dt $BatchDir -p $FeedName -br $BatchFile";

$MaxGroups = `wc -l $Newsrc`;

($LoMark, $HiMark) = &FindStartPoint ($Newsrc, $NumGroups);

chdir ($SuckDir);
$SuckCmd = "$SuckDir/suck $FeedName $SuckFlags";

$| = 1;

while ($LoMark < $MaxGroups) {
	&SetupNewsrc ($Newsrc, $LoMark, $HiMark);

	printf "RUN  [%04d - %04d]  %s\n", $LoMark, $HiMark, $SuckCmd;

	if (open (SUCK, "$SuckCmd |")) {
		while (<SUCK>) {
			print;
		}
		close (SUCK);
		if (-f $BatchFile) {
			$RnewsCmd = "$RnewsDir/rnews -S localhost $BatchFile";
			print "$RnewsCmd\n";
			if (open (RNEWS, "$RnewsCmd |")) {
				while (<RNEWS>) { 
					print; 
				}
				close (RNEWS);
				print "Deleting $BatchFile\n";
				unlink ($BatchFile);
			} else {
				print "Warning: RNEWS - $!\n";
			}
		}
	} else {
		print "Warning: SUCK - $!\n";
	}

	$LoMark += $NumGroups;
	$HiMark += $NumGroups;
}

exit 0;

#############################################################################
#
#

sub FindStartPoint
{
	my ($Newsrc, $NumGroups) = @_;
	my ($Line, $Lo, $Hi);

	$Line = $Lo = 0;
	$Hi = $NumGroups;

	open (NEWSRC, "$Newsrc") || die "Error: $Newsrc - $!\n";
	while (<NEWSRC>) {
		if (/^[A-z]/) {
			$Lo = $Line;
			$Hi = $Lo + $NumGroups;
			break;
		}
		$Line++;
	}
	close (NEWSRC);

	return ($Lo, $Hi);
}

sub SetupNewsrc
{
	my ($Newsrc, $LoMark, $HiMark) = @_;
	my ($Line) = 0;

	open (OLD, "$Newsrc") || die "Error: $Newsrc - $!\n";
	open (NEW, ">$Newsrc.tmp") || die "Error: $Newsrc.tmp - $!\n";
	while (<OLD>) {
		s/#\ //g;
		if ($Line >= $LoMark && $Line < $HiMark) {
			printf "GET  [%04d]  $_", $Line;
			print NEW;
		} else {
			print NEW "# $_";
		}
		$Line++;
	}
	close (NEW);
	close (OLD);

	`mv $Newsrc.tmp $Newsrc`;
}


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