SHARE
TWEET

test_network.sh

a guest Mar 30th, 2013 7 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/sh
  2. newline='
  3. '
  4. NETWORK=$(ifplugstatus wlan0)
  5. echo "COMMAND: $NETWORK"
  6. RESULT=$(echo $NETWORK | grep "unplugged")
  7. echo ""
  8. echo "RESULT: $RESULT"
  9. echo ""
  10. LEN_RESULT=${#RESULT}
  11. echo "Length of RESULT: $LEN_RESULT"
  12. echo ""
  13. if [ $LEN_RESULT -lt 2 ]
  14. then
  15. echo "Network up!"
  16. else
  17. echo "Network down!"
  18. echo ""
  19. echo "Attempting to restart the network connection..."
  20. echo ""
  21. sudo ifdown --force wlan0
  22. echo ""
  23. sudo ifup --force wlan0
  24. echo "Done."
  25. fi
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top