Article View: news.software.readers
Article #266036Re: [slrn] post article from command line?
From: Ted Heise
Date: Tue, 16 May 2023 12:09
Date: Tue, 16 May 2023 12:09
73 lines
2435 bytes
2435 bytes
On Tue, 16 May 2023 02:20:21 -0000 (UTC),
Grant Edwards <invalid@invalid.invalid> wrote:
> Is there a way to use slrn to post an article to an nntp server from
> the command line?
>
> If not, is there some other command-line utilty to do that?
>
> Python is removing NNTP support from the standard library, so my
> simple "inews" workalike is gong to stop working unless I start
> maintaining a Python NNTP implementation.
>
> :/
This is the script I use on panix to periodically post an FAQ,
perhaps it could be helpful.
------- begin quote -----------------------
#!/usr/local/bin/perl5.22
use warnings;
use strict;
use Net::NNTP;
my $server_name="news.panix.com";
my @post=`cat FAQ/araa-FAQ-v1.16`;
my $Server = Net::NNTP->new($server_name, Reader => 1, Debug =>
0);
if (!$Server)
{
print " Can't connect to news! Not posted\n";
}
else
{
$Server->post();
my $ServerCod = $Server->code();
if ($ServerCod == 340)
{
$Server->datasend(@post);
$Server->dataend;
if (!$Server->ok())
{
my $ServerMsg = $Server->message();
$Server->quit();
print " Posting failed! Response from news server:\n" .
$Server->code() . " $ServerMsg\n";
}
else
{
print " Posted OK\n";
}
}
else
{
print " Post command not accept\n";
}
$Server->quit();
}
------- end quote -------------------------
I invoke it by a crontab entry. Can't recall where I got the
script in the first place, but I'm *sure* it wasn't written by me.
I probably just STFWd for it.
--
Ted Heise <theise@panix.com> West Lafayette, IN, USA
Technical Details
Message-ID:
<slrnu66sjd.1jk.theise@panix2.panix.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mailReferences:
<u3up95$47o$1@reader2.panix.com>Show Full Headers
Complete Article Headers
Message-ID: <slrnu66sjd.1jk.theise@panix2.panix.com> Subject: Re: [slrn] post article from command line? Date: Tue, 16 May 2023 12:09:17 +0000 From: Ted Heise <theise@panix.com> References: <u3up95$47o$1@reader2.panix.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail Newsgroups: news.software.readers Organization: My own, such as it is Injection-Date: Tue, 16 May 2023 12:09:17 -0000 (UTC) Injection-Info: reader2.panix.com; posting-host="2001:470:30::a654:102"; logging-data="11597"; mail-complaints-to="abuse@panix.com" User-Agent: slrn/1.0.3 (NetBSD)