Git Product home page Git Product logo

cloudflare_ddns_updater's Introduction

Cloudflare DDNS Updater

A shell script to manage cloudflare DNS via their rest API

version: 0.4.0 (semver)

Usage

  • Clone the repository.
  • Ensure the script is executable. chmod +x cloudflare-ddns-updater.sh
  • Set the envionment variables (detailed below) to your domain/account details OR create a settings.conf in the same directory as the script (example syntax below).
    • If using the settings.conf file, it is recommended to ensure the file has the permissions set to 600. chmod 600 settings.conf
  • The script can be run manually, or use cron to run it on a schedule.
    • To schedule with cron, open crontab with crontab -e
    • Paste in */10 * * * * /path/to/cloudflare-ddns-updater.sh This will run the script every 10 minutes.

NOTE: The settings.conf takes precedence over environment variables. This is useful if multiple instances of the script is needed.

Environment Variables

Name Example Value Required Fallback value
CLOUDFLARE_API_ENDPOINT https://api.cloudflare.com/client/v4 False https://api.cloudflare.com/client/v4
CLOUDFLARE_API_KEY 1234567890987654321 True None
CLOUDFLARE_DEFAULT_TTL 3600 False 120
CLOUDFLARE_DOMAIN example.com True None
CLOUDFLARE_EMAIL [email protected] True None
CLOUDFLARE_ZONE_ID 123abc456xzy123abc456xzy True None
ENABLE_DEBUG 0 OR 1 False 0

Example settings file

api_key=1234567890987654321
domain=example.com
[email protected]
zone_id=123abc456xzy123abc456xzy

Script Arguments

-f Specificies a command to run upon failure (optional)

-h Prints help message

-s Specificies a command to run upon success (optional)

-v Prints version

Changelog

0.2.3

  • First release

0.3.0

  • Added environment variable functionality
  • Cleanup up script
  • Added logging

0.4.0

  • Added -h, -f, -s and -v script arguments to:
    • Print help
    • Run a failure command
    • Run a success command
    • Print version number

0.4.1

  • Bugfixes

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.