Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
From: Tony Hammitt <thammitt@kc.rr.com>
Subject: Re: Need help on bash scripting
Date: 2000/04/11	[thread overview]
Message-ID: <38F39D2B.2BD5B902@kc.rr.com> (raw)
In-Reply-To: 8cvq2r$5jp$1@nnrp1.deja.com

Neoklis wrote:
> 
> Hi!
> 
> I am trying to write a bash script to start a PPP connection by running
> /etc/ppp/ppp-up and then downloading a number of websites into a file
> using the -dump facility of Lynx.
> 
> I need a way of detecting the completion of the PPP connection by pppd
> before allowing the script to start Lynx, and also a way to re-try the
> connection if it fails for some reason (busy abort etc).
> 
> I have tried tailing /var/log/messages using grep to look for messages
> from chat and pppd, but this is becoming much too complex as there seem
> to be many different situations arising, especially when my ISP is
> overloaded. Any help appreciated.
> 
> Thanks in advance!
> 
> --
> Regards
> 
> Neoklis
> My (ex-Acorn) RiscOS Homepage: http://www.arcsite.de/hp/neoklis
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.

This isn't what you requested specifically, but here goes...

if you have 3 commands, one to execute, one for when the first
one fails and one for when the first one works, here's how to do
it in /bin/sh

command && do_when_worked || do_when_fails

So, if you have three scripts, one that tries to establish ppp
connection, one for starting up lynx and one for when it fails,
you can use the above syntax for that.

Make sure that the first script returns 0 when it works and some
non-zero value when it doesn't, because that's what the && and ||
work from.

If you already knew all of this, maybe someone else will get some
benefit from it.

Feel free to post your scripts, I'm sure that other people will
have this issue in the future.

Regards,

Tony Hammitt



  reply	other threads:[~2000-04-11  4:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-04-11  4:00 Need help on bash scripting Neoklis
2000-04-11  4:00 ` Tony Hammitt [this message]
2000-04-12  4:00 ` bmeyer
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox