Last active
April 18, 2017 02:38
-
-
Save markryd/f64abb84c1f2594fe84084e198e63a9d to your computer and use it in GitHub Desktop.
Revisions
-
markryd revised this gist
Apr 18, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ if [ -f /home/pi/heartbeat/rebooting ] ; then exit 0 fi # ping and exit on success ping -c 1 -w 5 8.8.8.8 &> /dev/null if [ "$?" = 0 ] ; then exit 0 -
markryd revised this gist
Apr 18, 2017 . 1 changed file with 1 addition and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,11 +8,7 @@ fi # ping and exit on success, wait 30s and try again since we can only cron every minute ping -c 1 -w 5 8.8.8.8 &> /dev/null if [ "$?" = 0 ] ; then exit 0 fi touch /home/pi/heartbeat/rebooting -
markryd created this gist
Apr 18, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ #!/bin/bash # check if we are already rebooting and exit if [ -f /home/pi/heartbeat/rebooting ] ; then exit 0 fi # ping and exit on success, wait 30s and try again since we can only cron every minute ping -c 1 -w 5 8.8.8.8 &> /dev/null if [ "$?" = 0 ] ; then sleep 30s ping -c 1 -w 5 8.8.8.8 &> /dev/null if [ "$?" = 0 ] ; then exit 0 fi fi touch /home/pi/heartbeat/rebooting echo "Rebooting modem $(date)" >> /home/pi/heartbeat/heartbeat.log /usr/local/bin/wemo switch "NBN modem" off sleep 2s /usr/local/bin/wemo switch "NBN modem" on sleep 5m rm /home/pi/heartbeat/rebooting exit 0