Created
July 30, 2018 18:56
-
-
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
This file contains hidden or 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 | |
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