🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #204972

Re: [slrn] Does the initial attempt to connect return a trappable code?

#204972
From: Blinky the Shark
Date: Mon, 27 Aug 2007 23:59
96 lines
4515 bytes
Pseudo Silk Kimono wrote:
> Greetings,
>
> Based on the recent outage on motzarella, I would like to create a
> script which will attempt to connect to news.motzarella.org and if
> it fails, attempt to use the other reader.motzarella.org and then
> nntp.motzarella.org.  I am not new to scripting and already have an idea
> of how I want to do it.  My question is, when I type slrn, it jumps 
> directly to the main "window".  Is there a way to invoke slrn in such a
> way that it does not immediatly display the main "window", rather it
> would allow me to interogate a return code, or status so that I can
> take action on a failed connection?
>
> Plan
>
> a)  create 3 .slrnrc files, one for each of the motzarella servers

You need not have three complete rc's.  Make one that has all of your
settings that aren't server-dependent (which will be 99% of slrnrc).
Make one for each server, with the server-dependent lines in it. Use
include statements in each of those to bring in, at slrn startup, the
non-server-dependent rc.  That way, when you want to change a general
(non-server-dependent) setting, you only have to change it in one file.

> b)  cp slrnrc_news .slrnrc
> c)  export NNTPSERVER=news.motzarella.org

You need not keep changing NNTPSERVER.  Run each server-version of slrn
from a shell script that includes the -h variable/argument.

Here's mine for news.individual.net:

#!/bin/bash
cleanscore -f ~/News/Score -e 2
rxvt -title 'Blinky NIN' +sb -e slrn -h news.individual.net

While yes, for slrn to run an NNTPSERVER environment variable seems
necessary, it's irrelevant what its value is if you run slrn with the
host variable.

> d)  try to connect to news.motzarella...
> e)  if it fails
>      i.  cp slrnrc_reader .slrnrc
>     ii.  export NNTPSERVER=reader.motzarella.org

Above.

>    iii.  try to connect to reader.motzarella.org
>     iv.  if it fails
>         A  cp slrnrc_nntp .slrnrc
>         B  export NNTPSERVER=nntp.motzarella.org

Above.

>         C  try to connect to nntp.motzarella.org
>         D  if it fails die

>From TFsM:

<q>

-h [snews://]host[:port]

    Connect to the NNTP server on host, overriding the $NNTPSERVER
environment variable. If no port is given, the default NNTP port
(119) will be used. The prefix snews:// indicates that slrn should
attempt a secure connection. This will result in an error message
when SSL support is not compiled in. Like -p, this option is only
accepted after --nntp or when NNTP is the default mode.

</q>

>From TFsM:

<q>

include

Usage: include filename

You can use this command to load an additional file that contains
configuration commands. With this feature, you can easily keep startup
files for different key bindings, colors etc. filename is relative to
your home directory (see $SLRNHOME). This can safely be done multiple
times and recursively.

</q>

(My suggestion uses it the other way around, providing you with common
key bindings, colors etc., and providing multiple *host* setups.)


-- 
Blinky                                                   RLU 297263 
Killing all posts from Google Groups
The Usenet Improvement Project: http://blinkynet.net/comp/uip5.html
Technical Details
Message-ID: <slrnfd6pc2.4ge.no.spam@thurston.blinkynet.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
References: <favh6c$9rj$1@registered.motzarella.org>

Show Full Headers
Complete Article Headers
Message-ID: <slrnfd6pc2.4ge.no.spam@thurston.blinkynet.net>
Subject: Re: [slrn] Does the initial attempt to connect return a trappable code?
Date: Mon, 27 Aug 2007 23:59:08 +0000
From: Blinky the Shark <no.spam@box.invalid>
References: <favh6c$9rj$1@registered.motzarella.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
Newsgroups: news.software.readers
Organization: http://blinkynet.net
Lines: 96
X-Trace: individual.net rupZ5jc6UpZrslzPep1DPw6PDX9fUkT2UnIjKQmbUf6HRZy+4I
Cancel-Lock: sha1:8Np+eqYFXLcdkUP5ty+g9VKgaU0=
X-The-Usenet-Improvement-Project: http://blinkynet.net/comp/uip5.html
X-Face: Jb-wQ7r&vrN}~8MC5B09S4&.ieh!Q:Di/XN.xrd#CU%;
 )bPa`Hm^(,3o$n(s75[P+$F+Q^4~Owj`WzkBtZU/#gL2BvEBm/e=/1,R0}d@q@)E
X-OS: Mandriva 2006 Linux; kernel 2.6.12
X-WebTV-Stationery: Standard; BGColor=black; TextColor=black
User-Agent: slrn/0.9.8.1 (Linux)