Created
March 12, 2020 02:56
Revisions
-
HouCoder created this gist
Mar 12, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ #!/bin/bash domain="duckdns.org" name="example-a-record" token="your token" # Get public IP from ipinfo.io public_ip="$(curl --silent ipinfo.io/ip)" # get current record current_record="$(dig @8.8.8.8 +short $name.$domain)" if [ "$current_record" != "$public_ip" ]; then echo New public IP is $public_ip curl "https://www.duckdns.org/update?domains=$name&token=$token&ip=$public_ip" else echo Nothing changed fi