Community discussions

MUM Europe 2020
 
fefo2006
just joined
Topic Author
Posts: 20
Joined: Sun May 13, 2007 5:27 pm

help with script than don´t work in 3.0 rc2

Tue Aug 14, 2007 3:51 am

Hi, this script work fine in mikrotik 2.9.45, but when upgrade to 3.0rc2 don´t work
This is the script:

/interface monitor-traffic [/interface find name "wds1"] once do {
:if ($sent-bits-per-second < 20000) do {
/queue simple remove [/queue simple find interface="ether1"]
:log warning "Traffic limit removed for ip address/network/interface"
}
}
Thanks...
 
Gerard
Trainer
Trainer
Posts: 336
Joined: Wed Apr 26, 2006 4:21 am
Location: Kentucky, USA
Contact:

Re: help with script than don´t work in 3.0 rc2

Tue Aug 14, 2007 6:17 am

Try this.. Haven't tested it..
/interface monitor-traffic [/interface find name="wds1"] once do={
 :if ( $"sent-bits-per-second" < 20000 ) do={
  /queue simple remove [/queue simple find interface="ether1"]
  :log info "Traffic limit removed for ip addres/network interface"
 }
}

-Gerard
Last edited by Gerard on Tue Aug 14, 2007 7:23 am, edited 1 time in total.
 
fefo2006
just joined
Topic Author
Posts: 20
Joined: Sun May 13, 2007 5:27 pm

Re: help with script than don´t work in 3.0 rc2

Tue Aug 14, 2007 7:00 am

ok, thank. i have 2 scripts more...

one is:
:if ([/system clock get time] = 03:50:00) do {/system shutdown :log info "APAGADO AUTOMATICO"
}
}

and the last is:
/interface monitor-traffic [/interface find name "wds1"] once do {
:if ($sent-bits-per-second > 20000 ) do {
/queue simple add name=(username . "_" . [:pick [/system clock get date] 4 6] . "-" . [:pick [/system clock get date] 0 3]
. "-" . [:pick [/system clock get date] 7 11] . "-" . [:pick [/system clock get time] 0 9]) limit-at=5000/15000
max-limit=5000/15000 interface="ether1" priority=1
:log warning "Traffic limit added for ip address/network/interface"
}
}

Thanks...
 
Gerard
Trainer
Trainer
Posts: 336
Joined: Wed Apr 26, 2006 4:21 am
Location: Kentucky, USA
Contact:

Re: help with script than don´t work in 3.0 rc2

Tue Aug 14, 2007 7:19 am

Hope these work.. I'm going to bed.. Scripts in 3.0 are very similar.. Variables are in quotes ie $"variable" and do is now do=

You can also type these in on the command line and it will highlight in different colors if it is correct or not..

-Gerard
:if ([/system clock get time] = "03:50:00") do={
 :log info "APAGADO AUTOMATICO";
 /system shutdown;
}
/int monitor-traffic [/interface find name="wds1"] once do={
 :if ($"sent-bits-per-second" > 20000 ) do={
  /queue simple add name=(username . "_" . [:pick [/system clock get date] 4 6] . "-" . [:pick [/system clock get date] 0 3] . "-" . [:pick [/system clock get date] 7 11] . "-" . [:pick [/system clock get time] 0 9]) limit-at=5000/15000 max-limit=5000/15000 interface="ether1" priority=1 
  :log warning "Traffic limit added for ip address/network/interface"
 }
}
 
fefo2006
just joined
Topic Author
Posts: 20
Joined: Sun May 13, 2007 5:27 pm

Re: help with script than don´t work in 3.0 rc2

Tue Aug 14, 2007 8:38 am

Ok, thank you very much for all and the fast reply...

Who is online

Users browsing this forum: No registered users and 11 guests