Internet Connectivity Test

From Bright Things Wiki
Jump to: navigation, search

Occasionally we have experienced USB 3G sticks "hanging" the only way to recover being a hard reset (power toggle) of the device.

The following cron job (scheduled task) will send one ping to Google every minute and will reboot device after 10 consecutive fails:

* * * * * if ping -q -c 1 >>/dev/null 2>&1; then echo 0 >/var/run/pingfail; else export PINGFAIL=`cat /var/run/pingfail` ; if [ "$PINGFAIL" -ge "10" ]; then /sbin/reboot; else expr 1 + 0$PINGFAIL >/var/run/pingfail ; fi; fi