2022-11-09 07:58:33 +05:30
|
|
|
# Enable WiFi in the morning
|
|
|
|
|
2022-11-09 07:59:41 +05:30
|
|
|
# using mode button
|
2023-08-07 09:53:05 +05:30
|
|
|
# /system routerboard mode-button set enabled=yes on-event=":log info \"Mode button pressed\"; /int wifiwave2 enable [find]; /int wireless enable [find];"
|
2022-11-09 07:59:41 +05:30
|
|
|
|
2022-11-09 07:58:33 +05:30
|
|
|
# as a cron event
|
2023-08-07 09:53:05 +05:30
|
|
|
# /system scheduler
|
|
|
|
# add comment="Enable WiFi @morning" interval=1d name="WiFi Enable" on-event="/int wifiwave2 enable [find]; /int wireless enable [find];" \
|
|
|
|
# policy=read,write,policy,test start-date=jan/03/2022 start-time=05:30:00
|
2022-11-09 07:58:33 +05:30
|
|
|
|
|
|
|
# as a script to be used
|
|
|
|
|
2022-11-15 06:41:20 +05:30
|
|
|
# Enable wireless / wifiwav2 interfaces if disabled.
|
2022-11-09 07:58:33 +05:30
|
|
|
|
2022-11-15 06:41:20 +05:30
|
|
|
:local interfaces
|
|
|
|
:local interface
|
2022-11-09 07:58:33 +05:30
|
|
|
|
2023-08-07 09:53:05 +05:30
|
|
|
# :do { wifiwave2 enable [find]; } on-error={ :log info "Error enabling wifiwave2 interfaces" }
|
2022-11-15 06:41:20 +05:30
|
|
|
:do {
|
2023-09-04 19:01:38 +05:30
|
|
|
:set interfaces [/int wifiwave2 print as-value]
|
2022-11-09 07:58:33 +05:30
|
|
|
|
2023-08-07 09:53:05 +05:30
|
|
|
} on-error={
|
2022-11-09 07:58:33 +05:30
|
|
|
|
2023-09-04 19:01:38 +05:30
|
|
|
:log info "Wifiwave2 doesn't exist!";
|
2022-11-09 07:58:33 +05:30
|
|
|
|
2023-08-07 09:53:05 +05:30
|
|
|
:do {
|
2023-09-04 19:01:38 +05:30
|
|
|
:set interfaces [/int wireless print as-value]
|
|
|
|
} on-error={ :error "Wireless doesn't exist"; }
|
2022-11-09 07:58:33 +05:30
|
|
|
|
2023-08-07 09:53:05 +05:30
|
|
|
}
|
2022-11-09 07:58:33 +05:30
|
|
|
|
2023-09-04 19:01:38 +05:30
|
|
|
/interface
|
2023-08-07 09:53:05 +05:30
|
|
|
:foreach interface in=$interfaces do={
|
|
|
|
:local wifiName ($interface->"name")
|
|
|
|
:if ( [get $wifiName disabled] = true ) do={
|
|
|
|
enable $wifiName
|
|
|
|
:log info "$wifiName is enabled";
|
|
|
|
} else={ :log info "$wifiName is already running" }
|
|
|
|
}
|