Last active
June 24, 2016 09:07
-
-
Save soffchen/4ca6f81b6dce20f88ba3dcda4065ce9d to your computer and use it in GitHub Desktop.
Duckdns script for RouterOS
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
:global currentIP; | |
:local newIP [/ip address get [find interface="cnc"] address]; | |
:local newIP [:pick $newIP 0 [:find $newIP "/"]]; | |
:if ($newIP != $currentIP) do={ | |
:log info "IP address $currentIP changed to $newIP"; | |
:set currentIP $newIP; | |
/tool fetch mode=https url="https://www.duckdns.org/update?domains=xxx&token=xxx&ip=$newIP" dst-path=duckdns.txt; | |
:local result [/file get duckdns.txt contents]; | |
:log info "Duck DNS update result: $result"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment