I am trying to write a script to update my users profile in hotspot/users
{:if ([/ip hotspot user find name="00:0C:42:69:40:2A" ] = True)
do={:put [set [/ip hotspot user find name="00:0C:42:69:40:2A"] profile="Premium" comment="Monteith,Stan"]}
else={:put [/ip hotspot user add name="00:0C:42:69:40:2A" profile="Premium"]}}
the problem I have with this script is that is always returns false and does the ‘else’ command
[admin@Boathouse_Longshot] /ip hotspot user> {:if ([/ip hotspot user find name="00:0C:42:69:40:2A" ] = True) do={:put [set [/ip hotspot user find
name="00:0C:42:69:40:2A"] profile="Premium" comment="Monteith,Stan"]} else={:put [/ip hotspot user add name="00:0C:42:69:40:2A" profile="Premium"
]}}
failure: already have user with this name for this server
If I use this command.
/ip hotspot user print where name="00:0C:42:69:40:2A"
I get the user printed.. so I know the user exists.. so when do my script always come back false?
to make it a bit more complicated I am also trying to find by the comment.
currently the script run from the command line this does not work
/ip hotspot user print where name="00:0C:42:69:40:2A" AND comment="Monteith,Stan"
[admin@Boathouse_Longshot] /ip hotspot user> /ip hotspot user print where name="00:0C:42:69:40:2A" AND comment="Monteith,Stan"
Flags: X - disabled, D - dynamic
# SERVER NAME ADDRESS PROFILE UPTIME
yet, both
/ip hotspot user print where name="00:0C:42:69:40:2A"
[admin@Boathouse_Longshot] /ip hotspot user> /ip hotspot user print where name="00:0C:42:69:40:2A"
Flags: X - disabled, D - dynamic
# SERVER NAME ADDRESS PROFILE UPTIME
0 ;;; Monteith,Stan
00:0C:42:69:40:2A Premium 0s
and
/ip hotspot user print where comment="Monteith,Stan"
[admin@Boathouse_Longshot] /ip hotspot user> /ip hotspot user print where comment="Monteith,Stan"
Flags: X - disabled, D - dynamic
# SERVER NAME ADDRESS PROFILE UPTIME
0 ;;; Monteith,Stan
00:0C:42:69:40:2A Premium 0s
work and come back with the same user, so why doesnt it work when I search for both?
thanks!
~Ken