Skip to content

Latest commit

 

History

History
44 lines (26 loc) · 1.47 KB

README.md

File metadata and controls

44 lines (26 loc) · 1.47 KB

Digital Ocean Dynamic DNS Updater

Simple Bash script to automatically add/update Digital Ocean DNS record for a domain. Includes basic error checking and common linux commands only.

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)

Usage

  1. Generate Personal Access Token from your Digital Ocean account.

  2. Modify the script to add access token and set script permission to 755.

     chmod 755 /path/to/file/do_dns_update.sh
    
  3. Cron the script to update Digital Ocean's DNS at desired frequency. (Note: API rate limit is currently 1200 /hr. Script run uses 2.)

     # once every two days @ 7:30am.
     30 07 */2 * * /path/to/file/do_dns_update.sh -s nas mydomain.com
    

Options

$ ./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

Requires

  • Domain added on Digital Ocean.
  • Crontab or equivalent.
  • Available linux commands: awk, curl, grep, mktemp, sed, tr

Adapted From

PHP / Python version

License

The MIT License (MIT).