I ran into an issue. Many issues:
1.
[lapsio@PiPi] > /system routerboard mode-button set enabled=yes on-event=autorun
Error, please generate supout file blah blah blah
So i upgraded to release-candidate. Now it doesn't say anything. But I can't really print value and it doesn't seem to work
[lapsio@PiPi] /system routerboard mode-button> :put [get enabled]
[lapsio@PiPi] /system routerboard mode-button> print
[lapsio@PiPi] /system routerboard mode-button>
I found that it's possible to use scheduler but... script doesn't execute properly:
1 name="autorun" owner="lapsio" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon last-started=aug/31/2017 21:35:28 run-count=25
source=
/log warning message="autorun start"
:delay delay-time=3s
/log warning message="autorun phase 1"
/system leds
set [find leds=wlan-led] type=off
set [find leds=link-act-led] type=off
:local choice "none"
/log warning message="autorun phase 2"
:while ($choice = "none") do={
/log warning message="autorun phase 3"
:if ($choice = "none") do={
:for counter=i from=1 to=10 do={
/log warning message="autorun phase 3b"
:delay delay-time=200ms
:if ([get [find leds=wlan-led] type] = "off") do={set [find leds=wlan-led] type=on} else={set [find leds=wlan-led] type=off}
:if ([/interface ethernet get ether1 running] = true) do={:set choice "ap"}
/log warning message="autorun phase 3c"
}
}
:if ($choice = "none") do={
:for counter=i from=1 to=10 do={
:delay delay-time=200ms
:if ([get [find leds=link-act-led] type] = "off") do={set [find leds=link-act-led] type=on} else={set [find leds=link-act-led] type=off}
:if ([/interface ethernet get ether1 running] = true) do={:set choice "station"}
}
}
}
/log warning message="autorun phase 4"
set [find leds=wlan-led] type=on
set [find leds=link-act-led] type=on
:delay delay-time=2s
set [find leds=wlan-led] type=wireless-status interface=wlan1
set [find leds=link-act-led] type=interface-activity interface=ether1
/log warning message="autorun phase 5"
:put $choice
:if ($choice = "ap") do={
/interface wireless set 0 mode=station disabled=no
:delay delay-time=2s
/system script run modetoggle
} else {
/interface wireless set 0 mode=ap-bridge disabled=no
:delay delay-time=2s
/system script run modetoggle
}
/log warning message="autorun end"
It stops on phase 3b according to logs. However when I run it manually via /system script run it works as expected :C
modetoggle does exactly what you said (if ap-bridge then change to station otherwise change to ap-bridge) I decided to split script in order to make it more flexible
Halp
Besides - it actually used to work properly but then after few reboots something crashed on mAP and I had to netinstall it. Now it stops just like I said even though I simply restored backup.