Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- /usr/bin/notify-send -i 'dialog-information' 'Running CheckNetUp.sh' 'Checking whether network is up'
- AtLeastOneSiteFound=false;
- # Try to download three sites and indicate a site was found if they work
- # as long as we can grab at least one site, we're good.
- # Otherwise, we'll disconnect and reconnect.
- /usr/bin/wget --spider --read-timeout=15 http://google.ca
- if [ "$?" = 0 ]; then
- AtLeastOneSiteFound=true;
- fi
- /usr/bin/wget --spider --read-timeout=15 http://facebook.com
- if [ "$?" = 0 ]; then
- AtLeastOneSiteFound=true;
- fi
- /usr/bin/wget --spider --read-timeout=15 http://wikipedia.org
- if [ "$?" = 0 ]; then
- AtLeastOneSiteFound=true;
- fi
- if [ "$AtLeastOneSiteFound" = false ]; then
- # Disconnect my wifi (and, consequently, VPN)
- /usr/bin/nmcli dev disconnect wlp0s20u2
- # Bring my wifi up
- /usr/bin/nmcli con up uuid e23f4af0-7411-4f4e-8d3c-a7cd35b607e1
- # Bring my VPN up
- /usr/bin/nmcli con up uuid 6b0f8740-df8e-411e-adeb-bcf70ced772f
- fi
- Error: Connection activation failed: Not authorized to control networking.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement