Advertisement
Guest User

Untitled

a guest
Sep 16th, 2014
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.76 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. LOGFILE=/var/log/wifitestlogfile.log
  4.  
  5. TESTIP=74.125.224.72
  6.  
  7. ping -c4 ${TESTIP} > /dev/null
  8.  
  9. if [ $? != 0 ]
  10. then
  11.  
  12. message="$(date) -- WiFi seems down, restarting - message from script /usr/src/scripts/wifi_test_2.sh"
  13. # echo >$LOGFILE empties the file so just the last log is saved
  14. echo $message >>$LOGFILE
  15.  
  16. ifdown --force wlan0
  17. ifup wlan0
  18. else
  19. message="$(date) -- WiFi seems up - message from script /usr/src/scripts/wifi_test_2.sh"
  20. # echo >$LOGFILE empties the file so just the last log is saved
  21. echo $message >>$LOGFILE
  22.  
  23.  
  24. fi
  25.  
  26. # how to update with reboot after 10 min of trying (cron runs script every min)?
  27.  
  28. Mon Sep 15 16:20:14 BST 2014 -- WiFi seems up - message from script /usr/src/scripts/wifi_test_2.sh
  29. Mon Sep 15 16:21:05 BST 2014 -- WiFi seems up - message from script /usr/src/scripts/wifi_test_2.sh
  30. Mon Sep 15 16:22:05 BST 2014 -- WiFi seems up - message from script /usr/src/scripts/wifi_test_2.sh
  31. Mon Sep 15 16:23:05 BST 2014 -- WiFi seems up - message from script /usr/src/scripts/wifi_test_2.sh
  32. Mon Sep 15 16:24:04 BST 2014 -- WiFi seems up - message from script /usr/src/scripts/wifi_test_2.sh
  33. Mon Sep 15 16:25:05 BST 2014 -- WiFi seems up - message from script /usr/src/scripts/wifi_test_2.sh
  34. Mon Sep 15 16:26:05 BST 2014 -- WiFi seems up - message from script /usr/src/scripts/wifi_test_2.sh
  35. Mon Sep 15 16:27:02 BST 2014 -- WiFi seems down, restarting - message from script /usr/src/scripts/wifi_test_2.sh
  36. Mon Sep 15 16:28:01 BST 2014 -- WiFi seems down, restarting - message from script /usr/src/scripts/wifi_test_2.sh
  37. Mon Sep 15 16:29:02 BST 2014 -- WiFi seems down, restarting - message from script /usr/src/scripts/wifi_test_2.sh
  38. Mon Sep 15 16:30:01 BST 2014 -- WiFi seems down, restarting - message from script /usr/src/scripts/wifi_test_2.sh
  39. Mon Sep 15 16:31:01 BST 2014 -- WiFi seems down, restarting - message from script /usr/src/scripts/wifi_test_2.sh
  40. Mon Sep 15 16:32:02 BST 2014 -- WiFi seems down, restarting - message from script /usr/src/scripts/wifi_test_2.sh
  41. Mon Sep 15 16:33:01 BST 2014 -- WiFi seems down, restarting - message from script /usr/src/scripts/wifi_test_2.sh
  42. Mon Sep 15 16:34:01 BST 2014 -- WiFi seems down, restarting - message from script /usr/src/scripts/wifi_test_2.sh
  43. Mon Sep 15 16:35:01 BST 2014 -- WiFi seems down, restarting - message from script /usr/src/scripts/wifi_test_2.sh
  44. Mon Sep 15 16:36:01 BST 2014 -- WiFi seems down, restarting - message from script /usr/src/scripts/wifi_test_2.sh
  45. Mon Sep 15 16:37:01 BST 2014 -- WiFi seems down, restarting - message from script /usr/src/scripts/wifi_test_2.sh
  46.  
  47.  
  48. **at this point force a reboot**
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement