Skip to content

Instantly share code, notes, and snippets.

@cecchisandrone
Created December 27, 2017 08:29
Show Gist options
  • Save cecchisandrone/25217d90c845e26f32a2ce71235ba383 to your computer and use it in GitHub Desktop.
Save cecchisandrone/25217d90c845e26f32a2ce71235ba383 to your computer and use it in GitHub Desktop.
Connection check for Raspberry PI
#!/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