Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
* Need help on bash scripting
@ 2000-04-11  4:00 Neoklis
  2000-04-11  4:00 ` Tony Hammitt
  2000-04-12  4:00 ` bmeyer
  0 siblings, 2 replies; 3+ messages in thread
From: Neoklis @ 2000-04-11  4:00 UTC (permalink / raw)


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.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Need help on bash scripting
  2000-04-11  4:00 Need help on bash scripting Neoklis
@ 2000-04-11  4:00 ` Tony Hammitt
  2000-04-12  4:00 ` bmeyer
  1 sibling, 0 replies; 3+ messages in thread
From: Tony Hammitt @ 2000-04-11  4:00 UTC (permalink / raw)


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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Need help on bash scripting
  2000-04-11  4:00 Need help on bash scripting Neoklis
  2000-04-11  4:00 ` Tony Hammitt
@ 2000-04-12  4:00 ` bmeyer
  1 sibling, 0 replies; 3+ messages in thread
From: bmeyer @ 2000-04-12  4:00 UTC (permalink / raw)


Neoklis <neoklis@my-deja.com> writes:

>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).

A relatively simple way is to just wait for a while, and then grep
through the output of "route" or "ifconfig", checking whether the
connection is up or not.

Bernie
-- 
The abdomen, the chest, and the brain will forever be shut from the
    intrusion of the wise and humane surgeon
Sir John Eric Ericksen
British surgeon, appointed Surgeon-Extraordinary to Queen Victoria



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-04-12  4:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-04-11  4:00 Need help on bash scripting Neoklis
2000-04-11  4:00 ` Tony Hammitt
2000-04-12  4:00 ` bmeyer

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