Created
July 25, 2018 16:17
-
-
Save ishrakr/0acf4d31c5091e6a96200462323c5045 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" | |
:global PreviousIP | |
:log info ("DuckDNS: Checking IP") | |
/tool fetch mode=https url="https://api.ipify.org/" dst-path=ip.txt | |
:local ExternalIP [/file get ip.txt contents] | |
: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