Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tunix/1161ce0ce713d5cee0b3 to your computer and use it in GitHub Desktop.
Save tunix/1161ce0ce713d5cee0b3 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Digital Ocean API Token
TOKEN=""
# Domain Details
DOMAIN=""
RECORD_ID=""
IP=$(curl -s ifconfig.me)
echo --- $(date +'%d.%m.%Y, %H:%M:%S') Start ---
curl -s -X PUT "https://api.digitalocean.com/v2/domains/$DOMAIN/records/$RECORD_ID" \
-d'{"data":"'$IP'"}' \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json"
echo --- $(date +'%d.%m.%Y, %H:%M:%S') End ---
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment