[GL-MT300N-V2] turning wi-fi on-off automatically

Is it possible to turn on and off the wi-fi using a schedule?
As example:
mon-fri | 08:00 | turn on wi-fi
mon-fri | 21:00 | turn off wi-fi
sat-sun | 10:00 | turn on wi-fi
sat-sun | 22:00 | turn off wi-fi
Thanks.

yes.

Or write a cron job, to disable/enable wifi.

use cron job. You can do this in Luci. Add scheduled task and don’t forget to enable crond as start up process. Then reboot the router.

Allright, this is what I did:

scp wifi_schedule.sh root@ROUTER_ADDRESS:/usr/bin/

# nano /etc/crontabs/root
00 07 * * Mon,Tue,Wed,Thu,Fri /usr/bin/wifi_schedule.sh start
00 20 * * Mon,Tue,Wed,Thu,Fri /usr/bin/wifi_schedule.sh stop
00 19 * * Sun /usr/bin/wifi_schedule.sh stop
00 19 * * Sat /usr/bin/wifi_schedule.sh stop
# /etc/init.d/cron enable
# /etc/init.d/cron start
# reboot

wifi_schedule.zip (2.7 KB)

1 Like

After the last update the script isn’t working anymore, so I decided to ditch it and use the wifionoff executable as follows:

# /etc/init.d/cron enable
# /etc/init.d/cron start
# nano /etc/crontabs/root
00 07 * * Mon,Tue,Wed,Thu,Fri /usr/bin/wifionoff on
00 20 * * Mon,Tue,Wed,Thu,Fri /usr/bin/wifionoff off
00 19 * * Sat /usr/bin/wifionoff off
00 19 * * Sun /usr/bin/wifionoff off
# /etc/init.d/cron restart

Can I just copy and paste this into advanced settings or is there more to set this up.

image

As stated in the note you have to restart the cron service maually.

How do I apply this to the WAN side of the router. I currently have this setup as a repeater with openvpn certificate.

Sorry man, can’t help you any further.

Even cleaner solution (doesn’t need wifischedule):

# /etc/init.d/cron enable
# nano /etc/crontabs/root
      00 07 * * * wifi up
      00 08 * * * wifi down
      00 18 * * * wifi up
      00 19 * * * wifi down
# /etc/init.d/cron restart

Done.

I think you also need to disable it in uci, otherwise, the WiFi will up after reboot.

ip link set dev ra0 down
ip link set dev ra0 up