I modified the script from dydns’s dynamic ip change, from the log, I see that it tries to run fetch command but after that I will not see “log info (“1”)” being executed, all I need to do is to send this command to dtdns.com:
http://www.dtdns.com/api/autodns.cfm?id=mysite.com&pw=mypass&ip=1.2.3.4
Can someone help to find out what error I hit with fetch command?
:global ddnsuser "username"
:global ddnspass "password"
:global theinterface "unifi"
:global ddnshost "mysite.com"
:global ipddns [:resolve $ddnshost];
:global ipfresh [ /ip address get [/ip address find interface=$theinterface ] address ]
:if ([ :typeof $ipfresh ] = nil ) do={
:log info ("DtDNS: No ip address on $theinterface .")
} else={
:for i from=( [:len $ipfresh] - 1) to=0 do={
:if ( [:pick $ipfresh $i] = "/") do={
:set ipfresh [:pick $ipfresh 0 $i];
}
}
:if ($ipddns != $ipfresh) do={
:log info ("DtDNS: IP-DtDNS = $ipddns")
:log info ("DtDNS: IP-Fresh = $ipfresh")
:log info "DDNS: Update IP needed, Sending UPDATE...!"
:global url "www.dtdns.com/api/autodns.cfm?id=$ddnshost&pw=$ddnspass&ip=$ipfresh"
:log info ("0")
/tool fetch url=$url mode=http
:log info ("1")
:delay 1
:log info ("2")
:global str [/file find name="DtDNS.$ddnshost"];
:log info ("3")
/file remove $str
:log info ("4")
:global ipddns $ipfresh
:log info "DtDNS: IP updated to $ipfresh!"
} else={
:log info "DtDNS: dont need changes";
}
}