Hi!
I’m restarting my Internet connection if it’s down. I’m not doing it on my rpi3 where openhab runs, but you could do it on the same machine where openhab runs.
A simple approach is to run a cron job every 5-15 mins or so, do a PING, and if the connection is down do a restart.
#!/bin/bash
#Your nic
INTERFACE="ethX"
# These lines won't really tell if internet is up/down
# Check anyway, but not acting on it at the moment
IS_UP=`cat /sys/class/net/${INTERFACE}/operstate`
echo "$IS_UP"
# Ping twice just to be sure
/bin/ping -c 2 8.8.8.8
/bin/ping -c 2 8.8.8.8
if [ $? -ge 1 ]; then
echo "Network down :("
#Run some scripts here like:
/etc/init.d/network restart
/path/myfirewallscript
/etc/init.d/restart some service
exit 1
else
echo "Network up! :)"
exit 0
fi
You could do this in openhab with execbinding, read status and then restart or do actions within openhab.
Regards, S