Using a Raspberry Pi Zero(RPi), with wifi, I sometimes have problem that the WiFi connection is lost. This is due to that, at our boat, we are using the Teltonika RUT 240 router. The router just have one receiver/transmitter, LAN and WAN WiFi are shared, and in some use cases the WiFi will temporarily be disconnected. To restart the WiFi quick the following solution is used.
This post will cover a solution, a bash script, with inspiration from this blogpost, but with some fine tuning. 😉
Another way could be using the watchdog function, described here, with reboot.
In this post, as an example, I will show how I detect if my AIS receiver/dispatcher stops receiving AIS targets, sent to Vesselfinder, and how an alert is forwarded to the SIGNL4 app.
I'm using NodeRed on a Raspberry Pi to realize the function