mirror of
https://github.com/pothi/mikrotik-scripts.git
synced 2025-06-24 23:18:38 +02:00
Improve wifi enable / disable scripts; update docs
This commit is contained in:
parent
0b07cdb7ac
commit
cc9206893b
4 changed files with 16 additions and 6 deletions
8
ap-scripts/README.md
Normal file
8
ap-scripts/README.md
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# Scripts for Access Point
|
||||||
|
|
||||||
|
Scripts for MikroTik devices with access point capability such as hAP series.
|
||||||
|
|
||||||
|
Current Scripts...
|
||||||
|
|
||||||
|
- Enable WiFi interfaces (early in the morning or whatever the preferred time).
|
||||||
|
- Disable WiFi interfaces (at night, for example)
|
|
@ -1,3 +1,4 @@
|
||||||
|
# Only for Router OS v6
|
||||||
# Ref: https://gist.github.com/sebastian13/47e788371474d73552593b621eeacd33
|
# Ref: https://gist.github.com/sebastian13/47e788371474d73552593b621eeacd33
|
||||||
|
|
||||||
:log info message=("mode button was pressed");
|
:log info message=("mode button was pressed");
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
/system scheduler
|
/system scheduler
|
||||||
add comment="Shutdown WiFi @night to avoid electronic interference!" interval=1d name="WiFi Disable" on-event=\
|
add comment="Shutdown WiFi @night to avoid electronic interference!" interval=1d name="WiFi Disable" on-event=\
|
||||||
"/int wifiwave2 disable [find]; /int wireless disable [find];" policy=ftp,reboot,read,write,policy,test start-date=mar/05/2022 start-time=00:04:00
|
":do { /int wifiwave2 disable [find] } on-error={}; :do { /int wireless disable [find] } on-error={}"\
|
||||||
|
policy=ftp,reboot,read,write,policy,test start-date=sep/03/2023 start-time=23:04:00
|
||||||
|
|
||||||
# /system routerboard mode-button set enabled=yes on-event=":log info \"Mode button pressed\"; /int wifiwave2 enable [find]; /int wireless enable [find];"
|
# /system routerboard mode-button set enabled=yes on-event=":log info \"Mode button pressed\"; /int wifiwave2 enable [find]; /int wireless enable [find];"
|
||||||
|
|
|
@ -15,21 +15,21 @@
|
||||||
:local interfaces
|
:local interfaces
|
||||||
:local interface
|
:local interface
|
||||||
|
|
||||||
/interface
|
|
||||||
# :do { wifiwave2 enable [find]; } on-error={ :log info "Error enabling wifiwave2 interfaces" }
|
# :do { wifiwave2 enable [find]; } on-error={ :log info "Error enabling wifiwave2 interfaces" }
|
||||||
:do {
|
:do {
|
||||||
:set interfaces [wireless print as-value]
|
:set interfaces [/int wifiwave2 print as-value]
|
||||||
|
|
||||||
} on-error={
|
} on-error={
|
||||||
|
|
||||||
:log info "Wireless doesn't exist!";
|
:log info "Wifiwave2 doesn't exist!";
|
||||||
|
|
||||||
:do {
|
:do {
|
||||||
:set interfaces [wifiwave2 print as-value]
|
:set interfaces [/int wireless print as-value]
|
||||||
} on-error={ :error "Wifiwave2 doesn't exist"; }
|
} on-error={ :error "Wireless doesn't exist"; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/interface
|
||||||
:foreach interface in=$interfaces do={
|
:foreach interface in=$interfaces do={
|
||||||
:local wifiName ($interface->"name")
|
:local wifiName ($interface->"name")
|
||||||
:if ( [get $wifiName disabled] = true ) do={
|
:if ( [get $wifiName disabled] = true ) do={
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue