Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- LOGFILE=/var/log/wifitestlogfile.log
- TESTIP=74.125.224.72
- ping -c4 ${TESTIP} > /dev/null
- if [ $? != 0 ]
- then
- message="$(date) -- WiFi seems down, restarting - message from script /usr/src/scripts/wifi_test_2.sh"
- # echo >$LOGFILE empties the file so just the last log is saved
- echo $message >>$LOGFILE
- ifdown --force wlan0
- ifup wlan0
- else
- message="$(date) -- WiFi seems up - message from script /usr/src/scripts/wifi_test_2.sh"
- # echo >$LOGFILE empties the file so just the last log is saved
- echo $message >>$LOGFILE
- fi
- # how to update with reboot after 10 min of trying (cron runs script every min)?
- Mon Sep 15 16:20:14 BST 2014 -- WiFi seems up - message from script /usr/src/scripts/wifi_test_2.sh
- Mon Sep 15 16:21:05 BST 2014 -- WiFi seems up - message from script /usr/src/scripts/wifi_test_2.sh
- Mon Sep 15 16:22:05 BST 2014 -- WiFi seems up - message from script /usr/src/scripts/wifi_test_2.sh
- Mon Sep 15 16:23:05 BST 2014 -- WiFi seems up - message from script /usr/src/scripts/wifi_test_2.sh
- Mon Sep 15 16:24:04 BST 2014 -- WiFi seems up - message from script /usr/src/scripts/wifi_test_2.sh
- Mon Sep 15 16:25:05 BST 2014 -- WiFi seems up - message from script /usr/src/scripts/wifi_test_2.sh
- Mon Sep 15 16:26:05 BST 2014 -- WiFi seems up - message from script /usr/src/scripts/wifi_test_2.sh
- Mon Sep 15 16:27:02 BST 2014 -- WiFi seems down, restarting - message from script /usr/src/scripts/wifi_test_2.sh
- Mon Sep 15 16:28:01 BST 2014 -- WiFi seems down, restarting - message from script /usr/src/scripts/wifi_test_2.sh
- Mon Sep 15 16:29:02 BST 2014 -- WiFi seems down, restarting - message from script /usr/src/scripts/wifi_test_2.sh
- Mon Sep 15 16:30:01 BST 2014 -- WiFi seems down, restarting - message from script /usr/src/scripts/wifi_test_2.sh
- Mon Sep 15 16:31:01 BST 2014 -- WiFi seems down, restarting - message from script /usr/src/scripts/wifi_test_2.sh
- Mon Sep 15 16:32:02 BST 2014 -- WiFi seems down, restarting - message from script /usr/src/scripts/wifi_test_2.sh
- Mon Sep 15 16:33:01 BST 2014 -- WiFi seems down, restarting - message from script /usr/src/scripts/wifi_test_2.sh
- Mon Sep 15 16:34:01 BST 2014 -- WiFi seems down, restarting - message from script /usr/src/scripts/wifi_test_2.sh
- Mon Sep 15 16:35:01 BST 2014 -- WiFi seems down, restarting - message from script /usr/src/scripts/wifi_test_2.sh
- Mon Sep 15 16:36:01 BST 2014 -- WiFi seems down, restarting - message from script /usr/src/scripts/wifi_test_2.sh
- Mon Sep 15 16:37:01 BST 2014 -- WiFi seems down, restarting - message from script /usr/src/scripts/wifi_test_2.sh
- **at this point force a reboot**
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement