Skip to content

Instantly share code, notes, and snippets.

@javiertoledo
Created July 30, 2018 18:56
Show Gist options
  • Save javiertoledo/76bd5c7ea11cd8e8ed2e897b585847e4 to your computer and use it in GitHub Desktop.
Save javiertoledo/76bd5c7ea11cd8e8ed2e897b585847e4 to your computer and use it in GitHub Desktop.
Script to update a DNSimple record with your computer's current public IP
#!/bin/bash
TOKEN="XXXXXXXXXXXXXXXXXXXXXXX" # Replace with a domain access token
DOMAIN_ID="theam.io" # Replace with your domain name
RECORD_ID="1234" # Replace with the Record ID
ACCOUNT_ID="1234" # Replace with the Account ID
IP=`curl -s http://icanhazip.com/`
curl -H "Authorization: Bearer $TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-X "PATCH" \
-i "https://api.dnsimple.com/v2/$ACCOUNT_ID/zones/$DOMAIN_ID/records/$RECORD_ID" \
-d "{\"content\":\"$IP\"}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment