:global previousIP
:log error "DNS-O-Matic IP: last IP $previousIP"
# get the current IP address from the internet (in case of double-nat)
/tool fetch mode=http address="checkip.dyndns.org" src-path="/" dst-path="/dyndns.checkip.html"
:local result [/file get dyndns.checkip.html contents]
# parse the current IP result
:local resultLen [:len $result]
:local startLoc [:find $result ": " -1]
:set startLoc ($startLoc + 2)
:local endLoc [:find $result "</body>" -1]
:global currentIP [:pick $result $startLoc $endLoc]
:if ($currentIP != $previousIP) do={
:log warning "DNS-O-Matic IP: new IP $currentIP"
:log warning "Open Dns IP : update now"
:set previousIP $currentIP
:local maticuser "username"
:local maticpass "password"
:local host "http://updates.dnsomatic.com/nic/update"
/tool fetch url=$host user=$maticuser password=$maticpass mode=http
} else={
:log error "DNS-O-Matic IP: no need to update"
}