I have 26k enteris in address-list. And with this code:
/ip firewall address-list remove number=[find list=redirect]
i randomly resieve “no such item (4)” error
This is 1st row of *.auto.rsc script. Next goes updated address-list.
I have 26k enteris in address-list. And with this code:
/ip firewall address-list remove number=[find list=redirect]
i randomly resieve “no such item (4)” error
This is 1st row of *.auto.rsc script. Next goes updated address-list.
Try
/ip firewall address-list remove [find where list=redirect]
Thanks, i’ll try. And will it work the same with:
/ip proxy access remove number=[find action=deny]
?
Should be working if you change it like I mentioned above.
Commands
/ip firewall address-list remove number=[find list=redirect]
and
/ip firewall address-list remove [find where list=redirect]
does exactly the same.
Error occurs in cases if command tries to remove an item that does not exist any more (dynamic entries that already was removed, other script or user manually is modifying address list at the same time when command is executed)
Is there any solution?
Use foreach loop which enumerate results of [find list=redirect] and for each element call remove command using exception handling (:do/on-error).
Use foreach loop which enumerate results of [find list=redirect] and for each element call remove command using exception handling (:do/on-error).
Прошу простить мое невежество.
А это как?
Я про “луп”. Т.е. делаю в скрипте несколько строк с одним тем же кодом (/ip firewall address-list remove number=[find list=redirect])?
Спасибо!
/ip firewall address-list
:foreach i in=[find list=redirect] do={
:do {
remove $i;
} on-error={ :put "xxx"};
}
Please forgive my ignorance.
But what does mean “xxx” in:
} on-error={ :put "xxx"};
Or should I leave it as is?
Thanks!
That is the message printed on error,
http://wiki.mikrotik.com/wiki/Manual:Scripting#Catch_run-time_errors
/ip firewall address-list :foreach i in=[find list=redirect] do={ :do { remove $i; } on-error={ :put "xxx"}; }
![]()
That is the message printed on error
Thanks a lot! I’ll try it.