#!/bin/bash # Filename: connect.sh # Author: robz # Version 300511 # Toggle internet connection on/off. # This works with the USB Speedtouch 330 (old silver squashed frog design) # Go to right click Applications > Edit menus and create a new launcher with # this line - "home/<user>/.scripts/connect.sh" SOUND="/usr/share/sounds/ubuntu/stereo/dialog-question.ogg" ICON="/usr/share/icons/gnome/48x48/status/network-offline.png" ICON2="/usr/share/icons/gnome/48x48/status/network-transmit-receive.png" ICON3="/usr/share/icons/gnome/48x48/status/network-error.png" text_log () { TEXT=$(dmesg | awk /"line is up"/'{ print $10$11,$12,"-",$14$15,$16 }' | \ tr -d "()") notify-send -i $ICON2 " ## ADSL is connected ##" "Max - $TEXT" echo $(date +%d/%m/%y" "%a" "%T)" -- "$TEXT >> $HOME/.dsl-sync.log } ps ax | grep p[p]pd > /dev/null if [ $? = 0 ]; then notify-send -i $ICON "## Disconnecting ADSL ##" & poff else notify-send -i $ICON2 "## Connecting ADSL ##" & pon adsl && sleep 15 ping -c1 google.com 2>&1 if [ $? = 0 ]; then text_log else notify-send -i $ICON3 "## Not Connected ! ##" & /usr/bin/canberra-gtk-play --volume 2 -f $SOUND & fi fi
Mint Serena 64 bit using the Mate desktop environment. Most of the following scripts will run on this machine, although some have only been tested with the Gnome desktop. Extra software requirements can be met by the Ubuntu and safe PPA repositories. Scripts may be re-written or added to from time to time, the date serves as the version number. Syntax highlighting on these pages is provided by GVim's "Convert to HTML" option.
Toggle internet connection
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment