Skip to content

Instantly share code, notes, and snippets.

@erikbuild
Created February 22, 2013 03:33
Show Gist options
  • Save erikbuild/5010516 to your computer and use it in GitHub Desktop.
Save erikbuild/5010516 to your computer and use it in GitHub Desktop.
#!/bin/bash
EMAIL="MY_EMAIL"
TOKEN="MY_API_KEY"
DOMAIN_ID="erikreynolds.com"
RECORD_ID="MY_NUMERIC_RECORD_ID"
echo "Getting current external IP"
IP="`curl -s http://icanhazip.com/`"
echo "Updating external record to $IP"
curl -H 'X-DNSimple-Token: $EMAIL:$TOKEN' \
-H 'Accept: application/json' \
-H "Content-Type: application/json" \
-i -X PUT https://DNSimple.com/domains/$DOMAIN_ID/records/$RECORD_ID.json \
-d {\\"record\\":{\\"content\\":\\"$IP\\"}} -s > /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment