By Jove! I think he's got it!

A project log for WiFi Manager for openWRT

An automatic switch between known APs.

Daniel RosemanDaniel Roseman 01/14/2017 at 07:520 Comments

So, it struck me as odd that the log would 'overflow' as it is a ring buffer in ram. It should be bulletproof. Well I was wrong in assuming that it was the log. And I think I may have my real answer. There is a known bug in init.d/network. When you invoke '/etc/init.d/network restart' you are playing russian roulette with the network interface. Sometimes the resources network needs in order to restart have not been released yet. Instead of waiting patiently for those resources, network crashes.

This is the reason cron is able to revive the router.

Read this for more details.

There is a fix. It involves editing part of init.d/network. Just adding a section to bring the wifi network down before attempting to restart the network.

I might just add a sanity check in the script that reboots the entire router when network crashes... Or just invoke 'wifi down' before restarting the network.