I need to use the find where command in a script.
I am trying to write a script where I need to turn off a guest wifi in my my CAPS-MAN at certain times.
I have over 90 CAPS and I only need to turn off only the ones where the names start with BTH. (examples: BTH indoor, BTH Outdoor, BTH room1, BTH corner, etc…)
for this example I am using print where just to test it.
this is how far I got but it is not working…
/caps-man radio> print where REMOTE-CAP-IDENTITY={BTH}
Don’t worry about the rest of the script, that part is working when I use the full syntax in the Terminal. I just need to get the FIND WHERE part working
Please assist, I know this forum always comes through.
Thanks
TroyQ
@TroyQ, @afuchs doesn’t bring anything, don’t waste your time.
# for print
/caps-man radio print where remote-cap-identity~"^BTH"
# for script simlpy replace "enable" with "disable" when needed
:foreach radio in=[/caps-man radio print as-value where remote-cap-identity~"^BTH"] do={
:local mac (($radio)->"radio-mac")
/caps-man interface enable [find where radio-mac=$mac]
}
But… what you want exactly do?
Disable / Enable all radio that have “BTH” at the start of radio name?
Probably you need ONLY THIS instead, is more simpler and linear:
/caps-man interface disable [find where radio-name~"^BTH"]
/caps-man interface enable [find where radio-name~"^BTH"]
Thank you! @rextended
You are a genius!
I just needed to turn the students WiFi off at night and leave the Faculty WiFi on.
This is what I ended up with using a script in scheduler:
This turns it off in the evening
/caps-man provisioning
set slave-configurations="" [find where comment~"^BTH"]
/caps-man radio
provision [find where remote-cap-identity~"^BTH"]
and this turns it back on in the morning
/caps-man provisioning
set slave-configurations="BTH Leerders" [find where comment~"^BTH"]
/caps-man radio
provision [find where remote-cap-identity~"^BTH"]