Created
March 24, 2019 11:51
-
-
Save junxy/706543d1deb14ba863b31c84100ea70a to your computer and use it in GitHub Desktop.
ddns(dnspod.com) update script
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
#!/bin/sh | |
# get public ip | |
myip=$(dig +short myip.opendns.com @resolver1.opendns.com) | |
echo "My IP: $myip" | |
curl -X 'POST' 'https://api.dnspod.com/Record.Ddns' \ | |
-H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \ | |
--data-urlencode 'format=json' \ | |
--data-urlencode 'sub_domain=xxx' \ | |
--data-urlencode 'record_line=default' \ | |
--data-urlencode 'record_id=xxx' \ | |
--data-urlencode "value=$myip" \ | |
--data-urlencode 'user_token=xxx' \ | |
--data-urlencode 'domain_id=xxx' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment