Quantcast
Channel: MikroTik
Viewing all articles
Browse latest Browse all 21032

Scripting • Re: Script stops for unknown reason

$
0
0
Is it working correctly from CLI?
Examine log "Total DHCP Servers: <number>" and number of "Get: <name>" log records, must be same number of log records as number of servers.
When condition operator is not stated while loop stops when variable is false boolean, empty array or 0 (same for any condition statement in script) and that's why is skipping number 0 (doesn't perform iteration for 0). You can just correct this in current script to :while ($counter >= 0) do={
or just use:
Code:
/ip/dhcp-server:foreach server in=[find] do={  :local servername [get $server name]  :log info ("Get: " . $servername)} 

Statistics: Posted by optio — Tue Dec 12, 2023 12:06 am



Viewing all articles
Browse latest Browse all 21032

Trending Articles