Simple Bash script to automatically add/update Digital Ocean DNS record for a domain. Includes basic error checking and common linux commands only, except for jq
which is designed to be easy to install.
My use case: Connect to home server that is on a dynamic IP via a fixed domain (ala DynDNS).
(e.g.- nas.mydomain.com vs. 74.125.231.100)
-
Generate Personal Access Token from your Digital Ocean account.
-
Place the token in ~/.config/do_dns_update/access_token
-
Cron the script to update Digital Ocean's DNS at desired frequency. (Note: DO API rate limit is currently 1200 /hr. Each script run uses 2 calls.)
# four times an hour */15 * * * * /path/to/file/do_dns_update.sh -s nas mydomain.com
$ ./do_dns_update.sh -h
Usage: do_dns_update.sh [options...] <record name> <domain>
Options:
-h This help text
-u Updates only. Don't add non-existing
-s Silent mode. Don't output anything
- Domain added on Digital Ocean.
- Crontab or equivalent.
- Available linux commands: jq, curl, grep, mktemp, sed, tr
The MIT License (MIT).