Can we set up a voice for disconnetion?

Oliver Grawert ogra at ubuntu.com
Thu Oct 20 13:45:12 UTC 2011


On 10/19/2011 08:12 PM, PM wrote:
> hi,
>
> I do some other work while downloading goes on. Is there any way such 
> that a voice comes or a siren be heard in case the INTERNET connection 
> is gone such that by listening it one is aware of the disconnection?
>
> thx.
>
>
below is a script i once used to monitor a connection on a desktop, it 
pops up a note telling you when the connection went down and plays a 
sound. to use it, just save it in ~/bin and then add it with full path 
to your startup applications in the system settings of your desktop. to 
change parameters just edit in the global section of t.

ciao
     oli

--- snip ---
#!/bin/sh

# global settings, change defaults here (interval is in seconds)
STRING="Internet went down at:"
SOUNDFILE=/usr/share/sounds/gnome/default/alerts/glass.ogg
INTERVAL=300
URL=www.ubuntu.com

# apps etc
DATE=$(date)
POPUPCMD="zenity --warning --text="
SOUNDCMD="paplay "

while true; do
         if [ ! "$(ping -c1 $URL 2>/dev/null)" ]; then
                 if [ ! "$(pgrep -lf "$POPUPCMD${STRING}")" ]; then
                         $SOUNDCMD$SOUNDFILE
                         $POPUPCMD"${STRING}\n${DATE}"
                 fi
         fi
         sleep $INTERVAL
done

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


More information about the ubuntu-users mailing list