Can we set up a voice for disconnetion?

PM ubuntu.bkn at gmail.com
Thu Oct 20 00:33:52 UTC 2011


> Paste the following into a file and make it executable with chmod +x
>
>
> #!/bin/bash
> ping -q -c 3 www.google.com > /dev/null
> rc=$?
> if [ ${rc} -ne  0 ]
> then
> espeak "Internet connection may be down" >/dev/null 2>&1
> fi
>

Would save the file with the name *alert.sh* and I should make it executable
like this:
*
sudo chmod +x alert.sh* (I googled it)

Call this shell script in your crontab as frequently as you'd like to check
> the connection.
>

I don't know how to call it in the crontab? (I am new...)


> Adjust this ping command to suit your needs.
>

After learning something, I would try to do this.


> Regardless of what happens with ping, we look at the return code and if
> it's not equal to zero we call espeak with a suitable message. This is where
> you'd pop your call to an mp3, an alarm noise, fire an email, log into the
> router and request it to reset itself, etc.
>

How to set a mp3 song here (if possible)?

This is, as you can see, a simplistic script - you could easily extend it to
> have multiple attempts before deciding the link was down, or hit multiple
> sites multiple times before alerting anyone and so forth. No error handling
> in this thing right now - it's not something I'd deploy to a server at work
> for example but it shows you the general idea.
>

Yeah thanks. If I don't open any browser, it would directly intimate me by
the voice alert...?

thx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20111020/e011b3e1/attachment.html>


More information about the ubuntu-users mailing list