Advertisement
Guest User

test_network.sh

a guest
Mar 30th, 2013
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.46 KB | None | 0 0
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement