Community discussions

MikroTik App
 
reza.mnp
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 90
Joined: Mon Jun 11, 2007 9:44 am
Location: ilam - iran
Contact:

problem with &

Tue Nov 23, 2010 5:19 pm

i want set uptime for users that server=all and profile=512
ip hotspot user set limit-uptime=35:00:00 [find server =all & profile =512]
but not work correct.
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: problem with &

Tue Nov 23, 2010 5:54 pm

/ip hotspot user set limit-uptime=35:00:00 [/ip hotspot user find server=all && profile=512]
& is a bitwise OR, && is a boolean OR. You mustn't have spaces between key/value pairs. Also, sub-commands (commands in [] pairs) don't inherit the scope, so you have to change into the "/ip hotspot user" context for the find operation. Alternatively, you can scope the entire thing:
/ip hotspot user {
  set limit-uptime=35:00:00 [find server=all && profile=512]
}
 
reza.mnp
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 90
Joined: Mon Jun 11, 2007 9:44 am
Location: ilam - iran
Contact:

Re: problem with &

Tue Nov 23, 2010 6:25 pm

Unfortunately does not work.
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: problem with &

Tue Nov 23, 2010 7:31 pm

I didn't pay enough attention fixing your original code, and the setter has the items and key/values in the wrong order.
/ip hotspot user set [/ip hotspot user find server=all && profile=512] limit-uptime=35:00:00
That works fine, as below:
[admin@corporate] /ip hotspot user> print detail where name=test
Flags: X - disabled, D - dynamic
 9   name="test" password="test" profile=1m uptime=1d13h58m46s bytes-in=32075936 bytes-out=200606091 packets-in=178406 packets-out=241941
[admin@corporate] /ip hotspot user> set [find name=test && profile=1m] limit-uptime=35:00:00
[admin@corporate] /ip hotspot user> print detail where name=test
Flags: X - disabled, D - dynamic
 9   name="test" password="test" profile=1m limit-uptime=1d11h uptime=1d13h58m46s bytes-in=32075936 bytes-out=200606091 packets-in=178406 packets-out=241941
[admin@corporate] /ip hotspot user>