Created
May 14, 2017 20:15
-
-
Save SandroMachado/87e591fc42f368636b251b566485ae46 to your computer and use it in GitHub Desktop.
Script to reboot the raspberry pi if there is no network available
This file contains 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 characters
#!/bin/bash | |
while true | |
do | |
wget -q --tries=10 --timeout=20 --spider http://google.com | |
if [[ $? -eq 0 ]]; then | |
echo "Online" | |
else | |
echo "Offline" | |
echo raspberry | sudo -S sudo reboot | |
fi | |
sleep 300 | |
done |
@tblong please feel free to use it.
Thanks @SandroMachado for giving me the base for what I needed. The changes needed for my situation were posed here:
https://gist.github.com/tblong/eec5ae1353f9ad9277845efc1760b4bb
I've updated @SandroMachado and @tblong's scripts to unload and reload the sdio driver, which resolves the network issue without rebooting the entire system: https://gist.github.com/adotagarwal/b6e4bb09e051638271fa3aff910f8eb4
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @SandroMachado, would you be willing to include an explicit license on this gist so I can give proper credit and make a couple of improvements?
Thanks,
Tyler