Code Monkey home page Code Monkey logo

digital-ocean-dynamic-dns's Introduction

A dependency free bash script to dynamically update your DNS on DigitalOcean.

Stolen from Inspired by Nicu Surdu's post: https://surdu.me/2019/07/28/digital-ocean-ddns.html

I wanted a dynamic DNS updater that I could control. There are a LOT of scripts out there that do it written in PHP, Python, Go, Perl, Node, etc. I couldn't find one (other than Nicu's) that could just run in bash with cURL.

Links

You can create a DigitalOcean personal access token here: https://cloud.digitalocean.com/account/api/tokens

Install

Copy secrets.example to secrets and fill in your info.

The "record IDs" can be found after putting in your access token and domain, then run ./get-dns.sh to output all of the records for that domain. Copy and paste the record(s) into the array (separated with spaces if you have more than one you want to update).

Once you've filled in all of the info in ./secrets you can run ./update-dns.sh which will find your current public IP, compare it to the current DNS record, and update the DNS record if the IP has changed.

Run it on the reg

You can set it up to run at whatever interval you prefer. cron is an easy choice:

# Every 30 minutes on the hour and half hour
*/30 * * * * /path/to/update-dns.sh >/dev/null 2>&1

# Every hour on the hour
0 * * * * /path/to/update-dns.sh >/dev/null 2>&1

Personally I like using services so I'll probably write up one of those in the future.

Contributing

If you have any additions I'd love to see them! Open a PR or an Issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.