Auto invoke browser upon wvdial successful Internet connection

Keven Ring keven at mitre.org
Mon May 3 16:48:40 UTC 2004


Bob Shaffer wrote:

>This will do what you want.
>
>#!/bin/bash
>
>nohup wvdial 1>/dev/null 2>/dev/null &
>
>while true; do
>    if [ -n "`/sbin/pidof pppd`" ]; then
>        # successfully connected
>        mozilla &
>        exit
>    fi
>    if [ -z "`/sbin/pidof wvdial`" ]; then
>        # wvdial failed and exited
>        xmessage "Failed to connect."
>        exit
>    fi
>    sleep 1
>done
>
># end of script
>
>It doesn't represent my life's work or anything, but it will work.
>You can just run "killall -2 wvdial" to close the connection.
>  
>

Argh!  Using a sledge hammer to drive a 6 penny nail....

Sure, you *can* do that.  However, since the docs on pppd indicate that 
it will invoke the script /etc/ppp/ip-up when a connection has been 
established, and furthermore, the /etc/ppp/ip-up script [at least, as 
distributed by Fedora] looks for [and then invokes] 
/etc/ppp/ip-up.local, you could do exactly what you suggested with the 
following:

#!/bin/sh
mozilla &

This uses the systems built-in notification mechanism, rather than 
writing custom scripts which may or may not take into account various 
failure options.  As far as "killing" your wvidal process, how about 
"ifdown ppp0" instead?  Alternatively, you could use the "modem lights" 
applet to your panel, and connect or disconnect from a GUI.

>You can actually set up pppd to dial for you, and dial on demand if you
>want too.  That way when you open a browser it will automatically dial for
>you if you're offline.
>  
>
While interesting, this would kind-of defeat the purpose of using 
wvdial, wouldn't it?  It also doesn't seem to be very effective in 
dynamic situations [such as typical dial-up, where you obtain a 
different IP every time you connect], but I could be wrong....

-- 
Keven Ring               | "Oh no,  Not Again..."
The MITRE Corporation    |   Bowl of Petunias -
7515 Colshire Drive      |   The Hitchhikers Guide to the Galaxy
McLean VA 22102-7508     |
PH: (703)883-7026        |







More information about the fedora-list mailing list