Article View: news.software.nntp
Article #35452Re: delayed feed howto?
From: christian mock
Date: Mon, 15 Feb 1999 00:00
Date: Mon, 15 Feb 1999 00:00
91 lines
2650 bytes
2650 bytes
In article <jon-1402992141000001@192.168.2.3>,
Jon Mansey <jon@nospaMinterpacket.net> wrote:
> Hi,
>
> Anyone have any pointers to information on how to set up a delayed feed
> under INN2.0?
I use this piece of perl.
ciao,
cm.
#!/usr/bin/perl
# -*- perl -*-
#
# delay lines for N seconds.
#
# primarily meant to be used with INN to generate a delayed feed with innfeed.
#
# put it into your newsfeeds file like
#
# innfeed-delayed!\
# :!*\
# :Tc,Wnm*,S16384:/usr/local/news/bin/delayer 60 \
# /usr/local/news/bin/startinnfeed -c innfeed-delayed.conf
#
#
#
# done by christian mock <cm@tahina.priv.at> sometime in july 1998,
# and put into the public domain.
#
$delay = shift || die "usage: $0 delay prog-n-args\n";
$timeout = $delay;
$eof = 0;
open(OUT, "|" . join(" ", @ARGV)) || die "open |prog-n-args: $!\n";
#select(OUT);
#$| = 1;
#select(STDOUT);
$rin = '';
vec($rin,fileno(STDIN),1) = 1;
while(!$eof || $#queue >= 0) {
if(!$eof) {
($nfound,$timeleft) =
select($rout=$rin, undef, undef, $timeout);
} else {
sleep($timeout);
}
$now = time(); $exp = $now + $delay;
if(!$eof && vec($rout,fileno(STDIN),1)) {
$line = <STDIN>;
if(!defined $line) { # exit NOW!
foreach(@queue) {
s/^[^:]+://g;
print OUT;
}
close(OUT);
sleep(1);
exit;
}
push(@queue, "$exp:$line");
}
if($#queue < 0) {
undef $timeout;
next;
}
($first, $line) = split(/:/, $queue[0], 2);
while($#queue >= 0 && $first <= $now) {
print OUT $line;
shift(@queue);
($first, $line) = split(/:/, $queue[0], 2);
}
$timeout = $first - $now;
}
--
christian mock @ home in vienna, austria
sind fremdcancels strafbar? -> http://www.tahina.priv.at/bincancel/
Those silly RFCs are all that separate us from the animals!
-- Kevin Rodgers in a.r.e
Technical Details
Message-ID:
<7aa1a3$34j$1@bauer.tahina.priv.at>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mailReferences:
<jon-1402992141000001@192.168.2.3>Show Full Headers
Complete Article Headers
Message-ID: <7aa1a3$34j$1@bauer.tahina.priv.at> Subject: Re: delayed feed howto? Date: Mon, 15 Feb 1999 00:00:00 +0000 From: cm@tahina.priv.at (christian mock) References: <jon-1402992141000001@192.168.2.3> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail X-Deja-AN: 444701337 X-Complaints-To: abuse@tahina.priv.at X-Trace: bauer.tahina.priv.at 919111811 3219 192.168.55.2 (15 Feb 1999 20:50:11 GMT) Organization: private NNTP-Posting-Date: 15 Feb 1999 20:50:11 GMT Newsgroups: news.software.nntp