Skip to content

Instantly share code, notes, and snippets.

@lewiswalsh
Last active May 27, 2022 19:06
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 lewiswalsh/46cb8a4d19dcb1477f648b6969316038 to your computer and use it in GitHub Desktop.
Save lewiswalsh/46cb8a4d19dcb1477f648b6969316038 to your computer and use it in GitHub Desktop.
Update DigitalOcean domain record from bash #bash
#!/bin/bash
# Use CRON to regularly update for DIY DynDNS
PUBLIC_IPV4=$(curl ifconfig.co)
API_ACCESS_TOKEN=<your_access_token>
RECORD_ID=<your_record_id>
curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer ${API_ACCESS_TOKEN}" -d '{"data":"'"${PUBLIC_IPV4}"'"}' "https://api.digitalocean.com/v2/domains/centralindustrial.co.uk/records/${RECORD_ID}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment