Thread View: news.software.nntp
2 messages
2 total messages
Started by Scott Gifford
Tue, 21 Oct 1997 00:00
Reliable on-spool NoCeM canceller...
Author: Scott Gifford
Date: Tue, 21 Oct 1997 00:00
Date: Tue, 21 Oct 1997 00:00
18 lines
1113 bytes
1113 bytes
I'd like to start processing NoCeM "Hide" messages on our news spool, but all of the information I've been able to find about on-spool NoCeM cancellers has dire warnings about trashing your history file if INN is paused or throttled when it tries to hide an article, or of getting so behind as to be completely useless. Have either of the on-spool NoCeM cancellers gotten to a reliable state? Processing NoCeMs would be a big win for us, but trashing our history file would be a MUCH bigger lose . . . Thanks for any info, ------Scott.
Re: Reliable on-spool NoCeM canceller...
Author: Rahul Dhesi
Date: Tue, 21 Oct 1997 00:00
Date: Tue, 21 Oct 1997 00:00
143 lines
5059 bytes
5059 bytes
In <62ivg1$feu$1@ramp2.tir.com> "Scott Gifford" <sgifford@tir.com> writes:
> I'd like to start processing NoCeM "Hide" messages on our news spool, but
>all of the information I've been able to find about on-spool NoCeM
>cancellers has dire warnings about trashing your history file if INN is
>paused or throttled when it tries to hide an article, or of getting so
>behind as to be completely useless.
I had problems with ncmspool but c-nocem worked well (with slight
modifications). My diffs are below, in case anybody is interested.
Partly cosmetic, partly to suppress perl warnings, partly to avoid being
killed by random signals, and partly to cause processing to be done very
N minutes rather than every N batches.
You can get both ncmspool and c-nocem by following the
links at http://www.cm.org/ .
--- 1.1 1997/08/23 17:09:03
+++ c-nocem 1997/08/27 07:55:08
@@ -1,9 +1,9 @@
-#!/usr/bin/perl
+#! /etc/LOCAL/bin/perl5.003
# NoCeM in the spool for C News and INN - grand unified program
# Written by Olaf Titz <olaf@bigred.inka.de>, May-Aug 1997.
# This program is in the public domain.
-$ID='$Id: c-nocem,v 1.1 1997/08/23 17:09:03 dhesi Exp $';
+$ID='$Id: c-nocem,v 1.8 1997/08/27 07:50:44 dhesi Exp $';
# For C News:
# set up a batched feed like this:
@@ -22,8 +22,9 @@
# ----------------------------------------------------------------------------
# Configuration
-$newsctl="/var/lib/news";
-$newsarts="/var/spool/news";
+$newsctl="/news/lib";
+$log = '/news/inn/log/c-nocem.log';
+$newsarts="/news/news";
$pubring="$newsctl/ncmring.pgp";
$perm="$newsctl/ncmperm";
@@ -31,7 +32,7 @@
$tmp="$newsctl/tmp"; # create this directory, do not use world writable /tmp
$batchfile="$tmp/noc.batch";
-$ENV{'PATH'}="/bin:/usr/local/bin:/usr/bin:$newsctl/bin:$newsctl/localbin";
+$ENV{'PATH'}="/news/bin:/bin";
$ENV{'PGPPATH'}="$newsctl/.pgp";
# ----------------------------------------------------------------------------
@@ -43,6 +44,10 @@
undef $opt_s if ($opt_n);
if ($opt_s) {
open(STDOUT, ">/dev/null") || die "open /dev/null: $!";
+} else {
+ # don't write to stdout -- it causes us to get SIGTTOU
+ open(STDOUT, ">/tmp/c-nocem.log");
+ open(STDERR, ">&STDOUT");
}
select STDOUT; $|=1;
@Month=("Jan", "Feb", "Mar", "Apr", "May", "Jun",
@@ -57,10 +62,10 @@
$del_one=21600/$opt_d;
$del_run=$del_one*3/2;
}
-$LOCK_SH = 1;
+## $LOCK_SH = 1;
$LOCK_EX = 2;
-$LOCK_NB = 4;
-$LOCK_UN = 8;
+## $LOCK_NB = 4;
+## $LOCK_UN = 8;
$groupcheck="";
if (-f $groups) {
@@ -96,18 +101,26 @@
$SIG{"HUP"}="shutdown";
$SIG{"TERM"}="shutdown";
$SIG{"INT"}="shutdown";
-print "Starting $ID\n\n" unless ($opt_s);
+$SIG{"PIPE"}="shutdown";
+$SIG{"TTOU"}="DEFAULT";
+my $timenow = scalar localtime(time);
+print "$timenow\nStarting [$$]\n$ID\n\n" unless ($opt_s);
+$lastruntime = time; # time of last batch run aka &deletethem
+$TIME_WAIT = 15 * 60; # wait this many seconds between batch runs
# Read the notice(s)
if ($opt_b || $opt_c) {
while ($file=<STDIN>, defined($file)) {
sleep $del_run;
@_=split(/[ \t\r\n]+/, $file); $file=$_[0];
- print STDOUT "File $file:\n" unless ($opt_s);
+ $timenow = scalar localtime(time);
+ $opt_s || print STDOUT "$timenow\n$file\n";
&procfile("<$file");
print STDOUT "\n" unless ($opt_s);
- if (--$m<0) {
+ if (--$m<0 || ((time - $lastruntime) > $TIME_WAIT)) {
+ # if read $opt_c filenames
&deletethem;
$m=($opt_c?$opt_c:99999999);
+ $lastruntime = time; # remember time of batch run
}
}
} else {
@@ -161,7 +174,7 @@
$SIG{"HUP"}="finish";
$SIG{"TERM"}="finish";
$SIG{"INT"}="finish";
- open(C, "$groupcheck|fastcancel -lci -f '$lf' >>$newsctl/log")
+ open(C, "$groupcheck|fastcancel -lci -f '$lf' >> $log 2>&1")
|| die "invoke fastcancel: $!";
}
$i=0;
@@ -199,8 +212,7 @@
if (!$pid) {
open(STDERR, ">&EW");
close(ER);
- exec "pgp -f $pgpargs $f >$tf";
- exit 99;
+ exec "pgp -f $pgpargs $f >$tf" || exit 99;
}
undef $s; undef $u;
close(EW);
@@ -361,6 +373,10 @@
sub shutdown
{
local($s)=@_;
+ # ignore any more SIGPIPE,
+ # but die on SIGTTOU
+ $SIG{'PIPE'} = 'IGNORE';
+ $SIG{'TTOU'} = 'DEFAULT';
if ($s) {
print STDOUT "SIG$s\n";
}
--
Rahul Dhesi <dhesi@spams.r.us.com>
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