Skip to content

Cordtus/ddns-recupdate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

# Dynamic Cloudflare DNS Updater

Never use a clunky DDNS service again. Use this clunky bash script instead.
Lightweight Bash script to fetch, update, and sync your Cloudflare **A records** to the host’s current public IPv4 address.

---

## Setup

```bash
# copy or clone the script
mkdir -p $HOME/scripts
cp dns-update.sh $HOME/scripts/

# make it executable
chmod 700 $HOME/scripts/dns-update.sh

Prerequisites * bash (4.x or later) * jq (1.5+) * Cloudflare API token with Zone → Read and DNS → Edit   Authenticate with Authorization: Bearer <TOKEN> only—do not send X‑Auth‑Email.


Usage

Manual (interactive zone/record selection)

bash $HOME/scripts/dns-update.sh [email protected] your_api_token

You will be prompted to pick the zones to update; only those zones’ A records are modified.

Automatic (all zones and records)

bash $HOME/scripts/dns-update.sh [email protected] your_api_token --auto

Updates every A record across all zones without user input.


Cronjob Example

Edit your crontab:

crontab -e

Run the updater every 15 minutes:

*/15 * * * * /home/<USER>/scripts/dns-update.sh [email protected] your_api_token --auto

Add SHELL=/bin/bash and a suitable PATH= line above the job if they are not already defined for your crontab. Replace <USER> with your actual username.


Logs

  • JSON log file: logs/log.json (created on first run in the same directory as the script)

  • Each entry records:

    • timestamp (UTC)
    • zone
    • record
    • status (updatedno_change, or failed)
    • old_ip / new_ip or ip depending on action
  • Script exits non‑zero on failure; cron will mail any error output to the user.


::contentReference[oaicite:0]{index=0}

About

Automated DNS record updating for cloudflare users with dynamic IP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages