-
-
Save venilton/4a44ccb62e088b2f7cab to your computer and use it in GitHub Desktop.
YDNS mikrotik script update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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