No description
- Shell 100%
|
|
||
|---|---|---|
| .gitignore | ||
| CLAUDE.md | ||
| README.md | ||
| update-dns.conf.example | ||
| update-dns.sh | ||
update-dns
Bash script to update Dynamic DNS records for multiple domains and hosts via the Namecheap Dynamic DNS API.
Requirements
bashcurl
Setup
Copy update-dns.conf.example to update-dns.conf and fill in your domains and passwords. Each line follows the format:
domain|password|host1,host2,host3
- domain — the root domain (e.g.
example.com) - password — the Dynamic DNS password from your Namecheap DNS settings
- hosts — comma-separated list of hosts to update (
@for root,*for wildcard)
Example:
example.com|your-ddns-password|@,*,subdomain
Lines starting with # and blank lines are ignored.
Usage
./update-dns.sh [--dry-run] [--config <file>] <ip>
| Argument | Description |
|---|---|
<ip> |
The IP address to set (required) |
--dry-run |
Log what would be updated without making any requests |
--config <file> |
Path to config file (default: update-dns.conf next to the script) |
Examples
# Update all records to 1.2.3.4
./update-dns.sh 1.2.3.4
# Dry run to verify what would be updated
./update-dns.sh --dry-run 1.2.3.4
# Use a custom config file
./update-dns.sh --config /etc/update-dns.conf 1.2.3.4
# Pipe output to a log file
./update-dns.sh 1.2.3.4 >> /var/log/update-dns.log
Output
Logs are written to stdout in logfmt format and can be piped to a file if needed.
time=2026-07-08T09:12:29Z level=info domain=example.com msg="Processing domain"
time=2026-07-08T09:12:29Z level=info host=@ domain=example.com msg="Attempting update"
time=2026-07-08T09:12:29Z level=info host=@ domain=example.com msg="Update successful"