Created
December 27, 2017 08:29
-
-
Save cecchisandrone/25217d90c845e26f32a2ce71235ba383 to your computer and use it in GitHub Desktop.
Connection check for Raspberry PI
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 characters
#!/bin/bash | |
echo Started connection check at $(date) | |
COUNTER=0 | |
while true | |
do | |
ping -c 4 libero.it > /dev/null | |
if [ $? -ne 0 ]; then | |
echo Connection lost at $(date) | |
COUNTER=`expr $COUNTER + 1` | |
fi | |
if [ $COUNTER -eq 3 ]; then | |
echo Rebooting at $(date) | |
reboot | |
fi | |
sleep 600 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment