Script to restart radio 90s after boot?

I've started using DFS channels on a couple of routers (BPI-R3 and OpenWrt One) and a problem I've noticed is that on boot, the radio never comes up by itself after the initial DFS CAC check completes successfully. I have to manually restart the 5GHz radio, which then immediately comes up properly and works fine. It just refuses to come up automatically. Very annoying in the event of a power failure.

Absent some other fix for this, I'd like a script that will run at boot and restart the radio after 90 seconds.

Unfortunately I don't have any knowledge at all of shell scripting and while I usually enjoying learning things, I've just spent the last week breaking my brain on another subject, so...

Would any kind soul be willing to A) write a script for this, and B) tell me how to use it (this could just be a link to the appropriate docs page for whatever implementation method is best suited), please?

if it's enough for you, for example 2 minutes after booting, here it is:

install the "at" package on the router
and edit the /etc/rc.local file (also with the graphical interface)

cat /etc/rc.local

# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

echo "wifi reload" | at now+2minutes

exit 0

https://superuser.com/questions/301946/linux-at-command-with-seconds-precision

if you really have to do it after 90 seconds, here it is:

cat /etc/rc.local

# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

sleep 90
wifi reload

exit 0

I hope that's enough for you...

ps: is based on using the wifi command:

wifi help
Usage: /sbin/wifi [config|up|down|reconf|reload|status|isup]
enables (default), disables or configures devices not yet configured.
1 Like

Thank you! I think I'll just use the second option; it doesn't seem like it's worth installing another package when the alternative is so straightforward.

Does wifi reload actually bring the radio down & back up again? I thought I remembered reading somewhere that it only reloads the configuration. I guess that's a rhetorical question because I'll just test it and find out. Easy enough to change it to wifi down + wifi up if necessary.

theoretically it should be enough, see this (at most you know what to do):

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.