Skip to content

Instantly share code, notes, and snippets.

@junxy
Created March 24, 2019 11:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save junxy/706543d1deb14ba863b31c84100ea70a to your computer and use it in GitHub Desktop.
Save junxy/706543d1deb14ba863b31c84100ea70a to your computer and use it in GitHub Desktop.
ddns(dnspod.com) update script
#!/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