Timer for selected SSIDs

Hello, I have a number of SSIDs in my house. I would like to disable some at specific times (e.g. the one that the kids use for example).
I am aware that there is a package to do so for the whole radio, but I need to keep the Wi-Fi up for home automation for example. Any idea? Thanks!

Thanks for your reply.
While it does work, it is a hardly maintainable approach...
I am sure this could be a welcome extension to the scheduler package!

put it in the crontab ...

Here is a script, that will create the necessary cron jobs for you.

cat << "EOF" > /root/startstop.scr
prefix=$(uci show wireless | grep "$ssid" | sed s/.ssid.*//)
starth=$(echo "$start" | awk '{split($0,t,":"); print t[1]}')
startm=$(echo "$start" | awk '{split($0,t,":"); print t[2]}')
stoph=$(echo "$stop" | awk '{split($0,t,":"); print t[1]}')
stopm=$(echo "$stop" | awk '{split($0,t,":"); print t[2]}')

echo "$startm $starth * * * uci set $prefix.disabled='0' && wifi # SSID $ssid starts at $start" >> /etc/crontabs/root
echo "$stopm $stoph * * * uci set $prefix.disabled='1' && wifi # SSID $ssid stops at $stop" >> /etc/crontabs/root

/etc/init.d/cron restart
exit 0
chmod 755 /root/startstop.scr

Use it that way:

/root/startstop.scr ssidname starttime stoptime


root@OpenWrt:~# /root/startstop.scr myssid 08:00 22:00
root@OpenWrt:~# crontab -l
00 08 * * * uci set wireless.wifinet3.disabled='0' && wifi # SSID myssid starts at 08:00
00 22 * * * uci set wireless.wifinet3.disabled='1' && wifi # SSID myssid stops at 22:00

You'll need to manually edit the crontab if you want to remove the jobs.


thank you, appreciated!

1 Like