:log info "DDNS Begin"
:global ddns-user ""
:global ddns-pass ""
:global ddns-interface ""
:global ddns-host ""
:global ddns-ip [/ip address get [/ip address find interface=$ddns-interface] address]
:if {[ :typeof $ddns-lastip] = nil } do={ :global ddns-lastip 0.0.0.0/0 }
:if {[ :typeof $ddns-ip] = nil} do={
:log info "DDNS: No addres present on your interface, plesae check."
} else={
# :if ($ddns-ip != $ddns-lastip) do={
:log info "DDNS: Sending update!"
:log info [/tool dns-update name=$ddns-host address=[:pick $ddns-ip 0 [:find $ddns-ip "/"] ] key-name=$ddns-user key=$ddns-pass ]
# :global ddns-lastip $ddns-ip
# } else={
# :log info ("DDNS: No change.")
# }
}
:log info ("DDNS: End.")]