From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111c93,a0f06d8c338f37ae X-Google-Attributes: gid111c93,public From: Tony Hammitt Subject: Re: Need help on bash scripting Date: 2000/04/11 Message-ID: <38F39D2B.2BD5B902@kc.rr.com>#1/1 X-Deja-AN: 609831913 Content-Transfer-Encoding: 7bit References: <8cvq2r$5jp$1@nnrp1.deja.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@rr.com X-Trace: typhoon2.kc.rr.com 955489580 24.94.177.44 (Tue, 11 Apr 2000 16:46:20 CDT) MIME-Version: 1.0 Reply-To: thammitt@kc.rr.com NNTP-Posting-Date: Tue, 11 Apr 2000 16:46:20 CDT Newsgroups: comp.os.linux.alpha 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