HI, I’m trying to figure out what needs restarting when my pi suddenly disappears from the network and then I get the emails later about the unit not reporting
It’s running on debian stretch, is there a script I can run to look for some sort of disconnections and have it automattically reboot the pi (I don’t care about pi uptime) or restart the wifi or something???
This runs the script we wrote every 5 minutes as sudo (so you have permission to do the shutdown command), writing its output to /dev/null so it won’t clog your syslog.
It’s a little crude but it will reboot your Pi when there is no network connection.
Not that I don’t necessarily like using a hammer, but I did this one… so… this post will shut after a year with no replies… let’s see if it can run for a year
@J604, I was having similar sounding problems with one of my setups, and the issue boiled down to the location of the Pi wasn’t ideal for the WiFi connection to hold steady. At first I thought my Pi was rebooting since it would lose connection at seemingly random times, but eventually connection was restored. However, I discovered that wasn’t the case (running top in an SSH shell will tell you how long since it last rebooted). Poking a bit I discovered that my Pi was too close to a large metal pipe that was apparently impacting its WiFi connectivity; moving the Pi a few inches completely resolved the problem. (Perhaps adding an external WiFi antenna would have helped too, but that would have been more work). So perhaps see if relocating the Pi yields a more stable WiFi connection.
@wiedehopf - is there a way to “reboot” the wifi connection with restarting the whole machine? A full reboot seems like a bit of overkill, but perhaps that’s the easiest path towards achieving a new WiFi attempt.
I’m not sure if it’s a location issue, it’s a floor above (wood frame) where my wifi router is… I just did a crude test using wget and a big file from archive.org and it seemed to pull it down pretty quickly, but I’ll bear it in mind!
I’m not an expert here, but I do believe it’s actually possible that being too close to the router can lead to issues at times (signal saturation?). That said, it might be worth just moving the Pi down closer to the router (same floor or same room), and see if connectivity changes. That might degrade the ADSB signal (if you’ve got it up a floor for better reception), but it’s probably worth it for the debugging.
How often are these dropouts? Is this every few minutes, once an hour, every couple days? I’d think you’d want to leave it in a better (?) location (relative to the router), for probably 5-6x the expected cycle of disconnects. if it doesn’t drop at all, then I’d expect you found the problem (location) - and then need to either figure how to better connect (ethernet, or Wifi antenna), or move it. if that doesn’t fix it, well then back to a software solution, perhaps.
It’s every couple of days… you know, those extremely infuriating to debug kind of issues, especially when it’s just a hobby and I don’t have the time to look at it in depth