33 lines
1.0 KiB
Plaintext
33 lines
1.0 KiB
Plaintext
|
:local dynUser "dynUserName"
|
||
|
:local dynPass "updaterClientKey"
|
||
|
:local dynHost "my-hostname.dyndns.org"
|
||
|
|
||
|
:local dynIp [:resolve $dynHost]
|
||
|
:tool fetch url="http://myip.dnsomatic.com/mypublicip.txt" mode=http
|
||
|
:local publicIp [file get mypublicip.txt contents]
|
||
|
/file remove mypublicip.txt
|
||
|
|
||
|
:log info "Dyn: Dyn hostname: $dynHost"
|
||
|
:log info "Dyn: Dyn IP: $dynIp"
|
||
|
:log info "Dyn: Public IP: $publicIp"
|
||
|
|
||
|
:if ($dynIp != $publicIp) do={
|
||
|
:log info "Dyn: Public IP changed, updating..."
|
||
|
:local result [/tool fetch \
|
||
|
url="https://$dynUser:$dynPass@members.dyndns.org/v3/update?hostname=$dynHost&myip=$publicIp" \
|
||
|
check-certificate=no \
|
||
|
output=user \
|
||
|
as-value ];
|
||
|
|
||
|
:if ($result->"status" = "finished") do={
|
||
|
:local resultData ($result->"data")
|
||
|
:if ($resultData = "good $publicIp") do={
|
||
|
:log info "Dyn: IP updated: $resultData"
|
||
|
} else={
|
||
|
:log info "Dyn: Update error: $resultData"
|
||
|
}
|
||
|
}
|
||
|
} else={
|
||
|
:log info "Dyn: No IP change, doing nothing."
|
||
|
}
|