On Tue, Oct 11, 2011 at 10:53, grantrocket2 <[email protected]> wrote:
> Hi, I have a dodgy internet connection. Every couple of hours when I'm doing 
> a big download, it will randomly turn off and lose connection.
> I need a sound to play on my computer to warn me that I have lost connection 
> on ppp0 and it needs to be reset and re-connected.
> I did a few google searches and there doesen't seem to be anyone with a 
> script for that.
> Linux mint 10
> Internet is a sprint wireless broadband modem.
> I would like the script to play a .wav or .mp3 of my choice.
> Can anyone help me design this? (I know very little C++ and even less VB)

Seems fairly trivial... this does what you want:

bladernr@klaatu:~$ while true; do
> [ `nmcli dev status |grep eth0|awk '{print $3'}` == "disconnected" ] && echo 
> "LOST CONNECTION!" || echo "STILL CONNECTED"
> sleep 10s
> done

Of course, simply swap out the echo statements for something that
plays a wave or mp3 from cli and replace eth0 with ppp0 and you're
good to go.  You said you don't know any C++ or VB though you won't be
using VB on a Linux box anyway... but I am assuming you know at least
basic shell scripting... if not, say something.

If that's all you want out of it, you could even lose the '|| echo
"STILL CONNECTED"' part of the code so it only does something if nmcli
says that the status is disconnected.

THAT, of course assumes a couple things:

A: you have nmcli installed (NetworkManager, which you may since
you're running Mint)
B: that nmcli will tell you about ppp0 (it SHOULD, but it's been a
long time since I've done any dial-up so this is untested).

To check b, to this while your ppp0 is connected:

nmcli dev status

and see what it says about your various network connections. You
should see something like this:

bladernr@klaatu:~$ nmcli dev
DEVICE     TYPE              STATE
eth0       802-3-ethernet    connected
wlan0      802-11-wireless   disconnected

As you can see, I'm currently running my GbE connection with wi-fi disconnected.


------------------------------------

To unsubscribe from this list, please email 
[email protected] & you will be removed.Yahoo! Groups 
Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/LINUX_Newbies/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/LINUX_Newbies/join
    (Yahoo! ID required)

<*> To change settings via email:
    [email protected] 
    [email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Reply via email to