I'm writing a script that updates some MikroTik equipment (update packages) and since now it worked perfectly but I ran into an issue. When I update older equipment that still does not have the "installation" parameter in the wireless interface, the default value is set to "Outdoor" and I lose the connection with my AP because the frequency is not compatible.
For stopping this issue, I create a scheduler that runs on startup and change the value of "installation" to "Any" and then removes itself. The real problem is there. If, for any reason, the update did not work, the script won't work either and will stay in the equipment (which then causes future updates not to work since the script is already there and I must delete it before).
I tried using the "execute" command so that if the code is invalid, it won't crash and will just skip this part, but is seems that I can't get the result of execute (I can get the ID but I don't get how to use it).
Is there any way to check if "installation" parameter exists?
Or any other way for that script to work :
Code: Select all
/system scheduler add disabled=no name="tempSchedChangeInstallation" \
on-event=("
:if ((:typeof [(:execute {[/interface wireless get wlan1 installation]})]) != \"nil\") do={
/interface wireless set installation=any wlan1;
:do {
:delay 5;
} while=((:execute {[/interface wireless get wlan1 installation]} != \"any\"));
}
/system scheduler remove tempSchedChangeInstallation;") \
policy="write" start-time=startup;
Thank you! :)