Schedule only some WiFi radios

Hi there, it is an already asked question but looking at old threads I have not found the best answer.

My config is:

"kernel": "5.15.150",
	"hostname": "RouterWRT",
	"system": "ARMv8 Processor rev 4",
	"model": "Xiaomi AX3600",
	"board_name": "xiaomi,ax3600",
	"rootfs_type": "squashfs",
	"release": {
		"distribution": "OpenWrt",
		"version": "23.05.3",
		"revision": "r23809-234f1a2efa",
		"target": "ipq807x/generic",
		"description": "OpenWrt 23.05.3 r23809-234f1a2efa"

I am using the luci-app-wifischedule but it does not have options to disable only certain radios. I looked here: https://github.com/openwrt/luci/tree/openwrt-21.02/applications/luci-app-wifischedule

So I would like to ask if this script is still the best approach: Scheduling on/off wifi - #8 by dibdot

or after 8 years I should do this differently? Because I have not truly understood how to use that one.

I need to disable every night the radio1 and radio2 while keeping always on the radio0.

Can someone drop a suggestion?

Should still work, what's unclear in using this script?

I am not an expert in this so I have some newbie questions.

If I understand correctly, I have to copy paste this script into a file named ap-toggle.sh, the file would be located in the router's /usr/bin/ and then Icall it with a cronjob.

My scenario should be:

0 2230 /usr/bin/ap-toggle.sh off radio1, radio2
0 0630 /usr/bin/ap-toggle.sh on radio1, radio2

radio0 should be unaffected.

  1. How is the notation for switching off at 22.30 and turning back on on 06.30 every day? I am unsure the one I wrote is the correct one.
  2. How to automate this? I see I have to reference this script in /etc/crontabs/root but I do not know how to do that.
  3. What if the router is powered off at 22.29 and turns back on at 22.32? The cronjob will fail?

Thanks @dibdot that you have replied.

The script in the current form only accepts two parameters max.
To match your requirements, copy the script to /usr/bin, make it executable (chmod +x ...) and put the following commands to your cron config in /etc/crontabs/root (create this file if it doesn't exist):

30 22 * * *    /usr/bin/ap-toggle.sh off radio1
30 22 * * *    /usr/bin/ap-toggle.sh off radio2
30 06 * * *    /usr/bin/ap-toggle.sh on radio1
30 06 * * *    /usr/bin/ap-toggle.sh on radio2

Finally restart the cron service with /etc/init.d/cron restart.

1 Like

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