Skip to content

Instantly share code, notes, and snippets.

@venilton
Created August 26, 2015 22:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save venilton/4a44ccb62e088b2f7cab to your computer and use it in GitHub Desktop.
Save venilton/4a44ccb62e088b2f7cab to your computer and use it in GitHub Desktop.
YDNS mikrotik script update
# Replace with your information
:local username "<yourusername}>"
:local password "<yourpassword>"
:local hostname "<yourhostname>.ydns.eu"
:global currentIP;
/ip cloud set ddns-enabled=yes
:local newIP [/ip cloud get public-address];
:if ($newIP != $currentIP) do={
:log info "IP address $currentIP changed to $newIP";
:set currentIP $newIP;
/tool fetch user=$username password=$password mode=https url="https://ydns.eu/api/v1/update/?host=$hostname" dst-path=ydns.txt;
:local result [/file get ydns.txt contents];
:log info "YDNS update result: $result";
} else={
:log info ("No YDNS update needed")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment