Skip to content

Instantly share code, notes, and snippets.

@josephabrahams
Last active August 29, 2015 14:21
Show Gist options
  • Save josephabrahams/9bddefaa985b79e37ce8 to your computer and use it in GitHub Desktop.
Save josephabrahams/9bddefaa985b79e37ce8 to your computer and use it in GitHub Desktop.
DNSimple Dynamic DNS Shell Script
#!/bin/sh
TOKEN="your-domain-api-token"
DOMAIN_ID="yourdomain.com"
RECORD_ID="12345" # Replace with the Record ID
IP="`curl http://jsonip.com | sed 's/{"ip":"\(.*\)"/\1/g' | sed 's/}//'`"
curl -H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-DNSimple-Domain-Token: $TOKEN" \
-X "PUT" \
-i "https://api.dnsimple.com/v1/domains/$DOMAIN_ID/records/$RECORD_ID" \
-d "{\"record\":{\"content\":\"$IP\"}}"
@josephabrahams
Copy link
Author

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