Skip to content

Instantly share code, notes, and snippets.

@ishrakr
Created July 25, 2018 16:17
Show Gist options
  • Save ishrakr/0acf4d31c5091e6a96200462323c5045 to your computer and use it in GitHub Desktop.
Save ishrakr/0acf4d31c5091e6a96200462323c5045 to your computer and use it in GitHub Desktop.
: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