Skip to content

Instantly share code, notes, and snippets.

@mislav
Last active December 10, 2015 22:38
Show Gist options
  • Save mislav/4503150 to your computer and use it in GitHub Desktop.
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.
#!/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}"
# part of ~/.netrc
machine dnsimple.com
login mislav.marohnic@gmail.com
password YOUWISH
@hamiltont
Copy link

I've updated to use the API tokens instead of user / password

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment