Last active
December 10, 2015 22:38
-
-
Save mislav/4503150 to your computer and use it in GitHub Desktop.
Use DNSimple API to update a DNS record using your current IP. When configured as a cron job, it makes for a good poor man's dynamic DNS solution.
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/bash | |
set -e | |
domain=mislav.net | |
record=511770 # mysubdomain.mislav.net | |
ip="$( curl -s icanhazip.com )" | |
payload="{ \"record\": { \"content\": \"${ip}\" } }" | |
curl -fsS --netrc \ | |
-H 'Accept: application/json' \ | |
-H 'Content-Type: application/json' \ | |
-X PUT -d "${payload}" \ | |
"https://dnsimple.com/domains/${domain}/records/${record}" |
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
# part of ~/.netrc | |
machine dnsimple.com | |
login [email protected] | |
password YOUWISH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've updated to use the API tokens instead of user / password