# 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.shPrerequisites *
bash(4.x or later) *jq(1.5+) * Cloudflare API token with Zone → Read and DNS → Edit Authenticate withAuthorization: Bearer <TOKEN>only—do not sendX‑Auth‑Email.
bash $HOME/scripts/dns-update.sh [email protected] your_api_tokenYou will be prompted to pick the zones to update; only those zones’ A records are modified.
bash $HOME/scripts/dns-update.sh [email protected] your_api_token --autoUpdates every A record across all zones without user input.
Edit your crontab:
crontab -eRun the updater every 15 minutes:
*/15 * * * * /home/<USER>/scripts/dns-update.sh [email protected] your_api_token --autoAdd 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.
-
JSON log file:
logs/log.json(created on first run in the same directory as the script) -
Each entry records:
timestamp(UTC)zonerecordstatus(updated,no_change, orfailed)old_ip/new_iporipdepending on action
-
Script exits non‑zero on failure; cron will mail any error output to the user.
::contentReference[oaicite:0]{index=0}