Last active
July 23, 2018 21:01
-
-
Save ishrakr/77d38b9e6dbdfbdad44fa9c11660b357 to your computer and use it in GitHub Desktop.
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
:local Token "your-token" | |
:local Domain "subdomain" | |
:local WanInterface "ether1" | |
:global PreviousIP | |
:global ExternalIP | |
:log info ("DuckDNS: Checking IP") | |
:local CurrentIP [/ip address get [/ip address find interface=$WanInterface ] address]; | |
:set ExternalIP [:pick $CurrentIP 0 [:find $CurrentIP "/"]]; | |
:if ($ExternalIP != $PreviousIP) do={ | |
:set PreviousIP $ExternalIP | |
/tool fetch mode=https url="https://www.duckdns.org/update?domains=$Domain&token=$Token&ip=$ExternalIP" keep-result=no | |
:log info ("DuckDNS: IP updated to $ExternalIP") | |
} else={ | |
:log info ("DuckDNS: IP not changed") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment