Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. /usr/bin/notify-send -i 'dialog-information' 'Running CheckNetUp.sh' 'Checking whether network is up'
  4.  
  5. AtLeastOneSiteFound=false;
  6.  
  7. # Try to download three sites and indicate a site was found if they work
  8. # as long as we can grab at least one site, we're good.
  9. # Otherwise, we'll disconnect and reconnect.
  10.  
  11. /usr/bin/wget --spider --read-timeout=15 http://google.ca
  12. if [ "$?" = 0 ]; then
  13. AtLeastOneSiteFound=true;
  14. fi
  15.  
  16. /usr/bin/wget --spider --read-timeout=15 http://facebook.com
  17. if [ "$?" = 0 ]; then
  18. AtLeastOneSiteFound=true;
  19. fi
  20.  
  21. /usr/bin/wget --spider --read-timeout=15 http://wikipedia.org
  22. if [ "$?" = 0 ]; then
  23. AtLeastOneSiteFound=true;
  24. fi
  25.  
  26. if [ "$AtLeastOneSiteFound" = false ]; then
  27. # Disconnect my wifi (and, consequently, VPN)
  28. /usr/bin/nmcli dev disconnect wlp0s20u2
  29. # Bring my wifi up
  30. /usr/bin/nmcli con up uuid e23f4af0-7411-4f4e-8d3c-a7cd35b607e1
  31. # Bring my VPN up
  32. /usr/bin/nmcli con up uuid 6b0f8740-df8e-411e-adeb-bcf70ced772f
  33. fi
  34.  
  35. Error: Connection activation failed: Not authorized to control networking.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement