On Tue, 16 May 2023 02:20:21 -0000 (UTC),
Grant Edwards <
[email protected]d> 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 <
[email protected]> West Lafayette, IN, USA
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)