RPI script to verify internet connection
Posted: Friday 08 December 2017 14:43
Hi
I have a RPI in my summerhouse (weather station, 10x temperature sensors, a few switches and Pikrellcam) for monitoring purposes. I use a stationary 4G router for internet connection. This connection is mostly stable, but occationally (a few times per year) there is need for a reboot of the 4G router. Does anybody have a script which checks for internet access, and if this is down runs a json command?
I think I need something like:
A job runs every 5 minute and checks for internet access
If internet access -> Do nothing
if internet access fails three times in a row, then run http://localhost/json.htm?type=command& ... tchcmd=Off
wait 1 minute
then run http://localhost/json.htm?type=command& ... itchcmd=On
The switch with IDX 46 is connected to a relay powering the 4G router.
Can somebody please point me in the right direction for writing such a script?
I have a RPI in my summerhouse (weather station, 10x temperature sensors, a few switches and Pikrellcam) for monitoring purposes. I use a stationary 4G router for internet connection. This connection is mostly stable, but occationally (a few times per year) there is need for a reboot of the 4G router. Does anybody have a script which checks for internet access, and if this is down runs a json command?
I think I need something like:
A job runs every 5 minute and checks for internet access
If internet access -> Do nothing
if internet access fails three times in a row, then run http://localhost/json.htm?type=command& ... tchcmd=Off
wait 1 minute
then run http://localhost/json.htm?type=command& ... itchcmd=On
The switch with IDX 46 is connected to a relay powering the 4G router.
Can somebody please point me in the right direction for writing such a script?