Created
December 23, 2016 18:14
-
-
Save floodkoff/ab8c5d69bccc725a345ddf97aaea7219 to your computer and use it in GitHub Desktop.
Updates DNS record of Digitalocean managed domain
This file contains 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 | |
API_KEY="ALLWORKANDNOPLAYMAKESJACKADULLBOYALLWORKANDNOPLAYMAKESJACKADULLB" | |
RECORD_ID="66666666" | |
DOMAIN="example.com" | |
ADDR=$(curl http://ipecho.net/plain) | |
# To get record ID for $DOMAIN | |
#curl \ | |
# -H "Authorization: Bearer $API_KEY" \ | |
# -H "Content-Type: application/json" \ | |
# -X PUT 'https://api.digitalocean.com/v2/domains/$DOMAIN/records | |
echo "Updading IP to '$ADDR'" | |
echo $(\ | |
curl \ | |
-H "Authorization: Bearer $API_KEY" \ | |
-H "Content-Type: application/json" \ | |
-X PUT "https://api.digitalocean.com/v2/domains/$DOMAIN/records/$RECORD_ID" \ | |
-d "{\"data\": \"$ADDR\"}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment