Article View: news.software.nntp
Article #78925controlcancel.pl
From: kjell
Date: Mon, 14 Apr 2008 18:24
Date: Mon, 14 Apr 2008 18:24
133 lines
4267 bytes
4267 bytes
I'm trying to run this script on my INN server
http://www.df.lth.se/~mikaelb/control.cancel/controlcancel.txt
I get this error "NNTPERROR: 502 Permission denied"
after this line "my ($first, $last) = $c->group("control.cancel");"
I get this error "NNTPERROR: 412 Not in a newsgroup"
after this line "for(; $last >= $first; --$last) {
my $head = join('', $c->head($last));
The script:
#!/usr/bin/perl
#
# controlcancel.pl v0.0.0
# Author: Mikael O. Bonnier, mikaelb@df.lth.se,
http://www.df.lth.se/~mikaelb/
# Copyright (C) 2007 by Mikael O. Bonnier, Lund, Sweden.
# License: GNU GPL v3 or later, http://www.gnu.org/licenses/gpl-3.0.txt
# Commercial licenses are available.
#
# Purpose: To store control.cancel messages for a group on an
NNTP-server
# in textfiles.
# Motive: Sometimes messages are canceled against the will of the
sender.
# In order to investigate this one needs the control.cancel message
but they
# normally can be difficult to find.
# Example: http://www.df.lth.se/~mikaelb/control.cancel/
# Installation: Adjust cfg-block in this file. Create an empty file
<group>_0000.txt in
# the <dir>. Run using crontab each night, e.g.
# 15 4 * * * cd <installdir>; <perldir>/perl ./controlcancel.pl &
# Ampersand in crontab makes the program uninterruptible. (Symbols in <>
should be
# exchanged for real values.)
#
print"$first $last\n";
print"1\n";
use strict;
print"2\n";
use NNTPClient; # Locally installed News::NNTPClient
print"3\n";
# <cfg>
my $NNTPServer = "just2write2.myftp.org";
print"4\n";
my $group = "swnet.politik";
print"5\n";
my $dir = "/var/www";
print"6\n";
my $delay = 0; # seconds
print"7\n";
# </cfg>
my $c = new News::NNTPClient($NNTPServer);
print"8\n";
$c->authinfo('xxxxxxxx','xxxxxxxxx');
print"9\n";
my ($first, $last) = $c->group("control.cancel");
print"10\n";
opendir CTRLCAN, $dir;
print"11\n";
my @files = grep /^$group\_(\d+)\.txt$/, readdir CTRLCAN;
print"12\n";
my $max = 0;
print"13\n";
foreach $_ (@files) {
$_ =~ m/(\d+)\.txt$/;
print"14\n";
if($1 > $max) {
$max = $1;
print"15\n";
}
}
my $inFile = sprintf "$group\_%04d.txt", $max;
print"16\n";
open IN, '<', $dir . $inFile;
print"17\n";
my $line;
print"18\n";
read IN, $line, 80;
print"19\n";
close IN;
print"20\n";
$line =~ m/\$last=(\d+)/;
print"21\n";
$first = $1 + 1 if $1;
print"22\n";
my $file = sprintf "$group\_%04d.txt", $max+1;
print"23\n";
open OUT, '>', $dir . $file;
print"24\n";
print OUT "\$first=$first, \$last=$last\n";
print"25\n";
my $starttime = time;
print"26\n";
print OUT "\$starttime=$starttime\n\n";
print"27\n";
for(; $last >= $first; --$last) {
my $head = join('', $c->head($last));
print"28\n";
if($head =~ m/^Newsgroups:.*[\s|,]+$group.*$/m) {
print OUT $c->article($last);
print"29\n";
print OUT "\n\n";
print"30\n";
}
sleep $delay;
print"31\n";
}
my $stoptime = time;
print"32\n";
print OUT "\n\$stoptime=$stoptime\n";
print"33\n";
print OUT "\$elapsed=" . ($stoptime-$starttime) . " s\n";
print"34\n";
close OUT;
print"35\n";
__END__
Technical Details
Message-ID:
<1208197485.32716.49.camel@ubuntu1.ipbo.se>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!news.karotte.org!news2.arglkargh.de!news.mixmin.net!just2write2.myftp.org!not-for-mailShow Full Headers
Complete Article Headers
Message-ID: <1208197485.32716.49.camel@ubuntu1.ipbo.se> Subject: controlcancel.pl Date: Mon, 14 Apr 2008 20:24:45 +0200 From: kjell <hd@ipbo.se> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!news.karotte.org!news2.arglkargh.de!news.mixmin.net!just2write2.myftp.org!not-for-mail Newsgroups: news.software.nntp Organization: Videokopiering Lines: 133 NNTP-Posting-Host: ubuntu1.ipbo.se Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: ubuntu1.ipbo.se 1208197485 32728 83.209.44.82 (14 Apr 2008 18:24:45 GMT) X-Complaints-To: hd@ipbo.se NNTP-Posting-Date: Mon, 14 Apr 2008 18:24:45 +0000 (UTC) In-Reply-To: <fta6v0$boh$1@news2.rz.uni-karlsruhe.de> X-Mailer: Evolution 2.12.0