Last active
December 19, 2015 07:09
-
-
Save wzpan/5916134 to your computer and use it in GitHub Desktop.
Shell - an applet to notify the network status.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| net_stat=1 | |
| while true | |
| do | |
| PINGRET=$( ping 8.8.8.8 -c 4 | grep "ttl=" ) | |
| [ -z "$PINGRET" ] && | |
| { | |
| if [ $net_stat -eq 1 ]; then | |
| notify-send -i /usr/share/icons/oxygen/48x48/actions/dialog-cancel.png "Warning" "Bad connection" | |
| net_stat=0 | |
| fi | |
| echo Bad connection | |
| }|| | |
| { | |
| if [ $net_stat -eq 0 ]; then | |
| notify-send -i /usr/share/icons/oxygen/48x48/actions/dialog-ok-apply.png "Congrats" "Network connected" | |
| net_stat=1 | |
| fi | |
| echo Network connected | |
| } | |
| sleep 5 | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment