Created
February 15, 2017 02:27
-
-
Save migeorge/1531291f0810dfb5931f4a887936b44c to your computer and use it in GitHub Desktop.
DD-WRT DigitalOcean Dynamic DNS
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
IPADDR=$(nvram get wan_ipaddr) | |
DO_KEY="Your DigitalOcean API Key" | |
DOMAIN="yourdomain.name" | |
DO_RECORD_ID=id_for_record_you_want_to_update | |
echo $IPADDR | |
echo Updating name server | |
curl -k "https://api.digitalocean.com/v2/domains/$DOMAIN/records/$DO_RECORD_ID" \ | |
-X PUT \ | |
-H "Content-Type: application/json" \ | |
-H "Authorization: Bearer $DO_KEY" \ | |
-d "{ \"data\": \"$IPADDR\" }" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage
DO_KEY
- A DigitalOcean API Key for your accountDOMAIN
- The domain you're updatingDO_RECORD_ID
- The ID of the A record you're updating (you can get that with a get request tohttps://api.digitalocean.con/v2/domains/$DOMAIN/records
0 0 * * * root /tmp/custom.sh
)Disclaimer
This script leverages
curl
in insecure mode (-k
), use at your own risk.