I occasionally have a wifi dropout and (I guess) because I use a remote SQL database for my library, eventually Kodi totally freezes meaning I have to power cycle to get it working again.
I know I can automatically start a bash script with Kodi on LibreELEC so have created this one, it seems to start OK but doesn't detect it loses connection (nothing's written to the log). Any ideas please?
I run LibreELEC on my ODROID-C2, is there a way to temporarily restore the heartbeat on the blue LED to verify it's not a total lockup?
Thanks for reading
Bash
#!/bin/bash
echo "Started checking at $(date)" >> /storage/checkwifi.log
while :
do
echo "$(tail -n 50 /storage/checkwifi.log)" > /storage/checkwifi.log
echo "Checking... $(date)"
if ! [ "$(ping -c 1 172.16.0.1)" ]; then
echo "Connection lost at $(date), restarting wifi" >> /storage/checkwifi.log
ifconfig wlan0 down
sleep 5
ifconfig wlan0 up
echo "Wifi started, waiting for connection" >> /storage/checkwifi.log
sleep 60
if ! [ "$(ping -c 1 172.16.0.1)" ]; then
echo "Connection not back up yet, adding extra delay" >> /storage/checkwifi.log
sleep 60
else
echo "Connected ok at $(date)" >> /storage/checkwifi.log
fi
else
echo "Connected OK at $(date)"
fi
sleep 60
done
Display More