🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #125182

Re: Little OT: script to start slrn

#125182
From: Matthew Malthouse
Date: Tue, 20 May 2003 16:20
85 lines
3298 bytes
On 26 Feb 2003 12:46:23 GMT DjB wrote:
}  Hi,
}  
}  I'm using slrn with 2 servers and now I'm looking to create a little
}  script in which you can choose which server you want to use, eg: 1. isp
}  2. pay server...
}  
}  Also, is it possible to include a check if slrn is alread running, and
}  display a message if this is the case ?
  
Slrn does this for itself.  Result of trying to start slrn with the same
srlnrc:
    fatal error:
    slrn: pid 1044 is locking the newsrc file.

}  Must be very simple to make, but I'm an absolute beginner when it comes
}  to scripting :(

Differenciate the servers with two .slrnrc files.

Then write script thus:

    #!/bin/bash
    #
    #  To use slrn with other servers
    #
    # This to use cis
    #
    german() {
    	if test -f .jnewsrc-german2
	    then slrn -h news.cis.dfn.de -f /home/matthew/.jnewsrc-german2
	else
	    echo "Where's the rc file gone?"
	    exit 1
	fi
    }
    #
    # This to use ntl
    #
    matthew() {
    	if test -f .jnewsrc-matthew
	    then slrn -h news.cable.ntlworld.com -f /home/matthew/.jnewsrc-matthew
	else
	    echo "Where's the rc file gone?"
	    exit 1
	fi
    }
    #
    # This to see which one to use
    #
    case "$1" in
        german)
	    german
	    ;;
	    
	matthew)
	    matthew
	    ;;

	*)
	    echo $"Usage: $0 {german|matthew}"
            exit 1
    esac
    exit $?

the script is /home/matthew/bin/start-slrn and invoked (because that dir 
is on my path "start-slrn matthew" or "start-slrn german" as required.


If you want a disection of the script start at the bottom with the case
statement.  This is looking for either german or matthew or anything
else (*).  Finding "german" it then calls the function german. Ditto for
matthew.  Failing either print and error message and exit.

The function first checks if there is a slrnrc to use.  If it finds it
invoked slrn with -h <use-this-server> and -f <use-this-slrnrc>; the
first so that the NNTPSERVER variable need not be set, or is ignored it
it is.

-- 
Il est important d'�tre un homme ou une femme en col�re; le 
jour o� nous quitte la col�re, ou le d�sir, c'est cuit.
      -   Barbara
http://www.calmeilles.co.uk/
Technical Details
Message-ID: <slrnbcklrs.10k.usenet@phanter.int.gnl>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!fu-berlin.de!uni-berlin.de!hadrian.guardian.co.UK!not-for-mail
References: <slrnb5pdt1.2at.dick@dbhome.bolderman.xs4all.nl>

Show Full Headers
Complete Article Headers
Message-ID: <slrnbcklrs.10k.usenet@phanter.int.gnl>
Subject: Re: Little OT: script to start slrn
Date: Tue, 20 May 2003 16:20:43 +0000
From: Matthew Malthouse <usenet@calmeilles.demon.co.uk>
References: <slrnb5pdt1.2at.dick@dbhome.bolderman.xs4all.nl>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!fu-berlin.de!uni-berlin.de!hadrian.guardian.co.UK!not-for-mail
Newsgroups: news.software.readers
Organization: Emporia Elusiva
Lines: 84
Reply-To: matthew@calmeilles.demon.co.uk
NNTP-Posting-Host: hadrian.guardian.co.uk (193.122.208.99)
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: fu-berlin.de 1053447643 29256710 193.122.208.99 (16 [24901])
User-Agent: slrn/0.9.7.4 (Linux)