Exports from my device are getting cut off after certain system scripts. It seems to be something to do with the contents of the script; if I install the following script on my router, it and everything in the configuration afterwards is removed:
:local domains [:toarray ""]
:local dnsttl "90m"
:local magiccomment "automatic-from-dhcp (magic comment)"
:local activehosts [:toarray ""]
:foreach lease in [/ip dhcp-server lease find] do={
:local hostname [/ip dhcp-server lease get value-name=host-name $lease]
:local hostaddr [/ip dhcp-server lease get value-name=address $lease]
:if ([:len $hostname] > 0) do={
:foreach domain in $domains do={
:local regdomain "$hostname.$domain"
:set activehosts ($activehosts, $regdomain)
:if ([:len [/ip dns static find where name=$regdomain]] = 0) do={
# add new entry
/ip dns static add name=$regdomain address=$hostaddr comment=$magiccomment ttl=$dnsttl
} else={
:if ([:len [/ip dns static find where name=$regdomain address=$hostaddr comment=$magiccomment]] = 0) do={
# update entry only if IP, name, and comment don't match
/ip dns static set address=$hostaddr [/ip dns static find name=$regdomain comment=$magiccomment]
}
}
}
}
}
# remove old entries
:foreach dnsentry in [/ip dns static find where comment=$magiccomment] do={
:local hostname [/ip dns static get value-name=name $dnsentry]
:if ([:type [:find $activehosts $hostname]] = "nil") do={
/ip dns static remove $dnsentry
}
}
The debug output is a little overwhelming considering my configuration is 600 lines long and each line seems to generate a half dozen lines of debug. How can I narrow down what the problem might be?
Exports from my device are getting cut off after certain system scripts. It seems to be something to do with the contents of the script; if I install the following script on my router, it and everything in the configuration afterwards is removed:
The debug output is a little overwhelming considering my configuration is 600 lines long and each line seems to generate a half dozen lines of debug. How can I narrow down what the problem might be?