Skip to content

adde88/DuckDNS-Updater

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🦆 DuckDNS Auto-Updater Scripts

Lightweight, robust, and zero-dependency scripts to automatically update your dynamic IP address for DuckDNS.

This repository contains two scripts tailored for different environments:

  1. Windows: A modern PowerShell (7.6+) script utilizing Invoke-RestMethod and the built-in Task Scheduler.
  2. Linux / OpenWrt / Embedded: A strict POSIX-compliant sh script relying on curl or wget and standard cron.

Both scripts feature built-in installation logic, meaning they can set themselves up to run silently in the background every 5 minutes with full logging capabilities.


⚠️ IMPORTANT: Configuration Needed Before Use!

Before running or installing either script, you MUST edit the files and replace the placeholder values with your actual DuckDNS details.

Open the scripts in a text editor and locate these exact lines at the top:

In both duckdns.ps1 and duckdns.sh: Change "CHANGE_ME" to your actual DuckDNS subdomain, and "CHANGE_ME_TO" to your private DuckDNS token.

DOMAIN="CHANGE_ME"       <-- e.g., "mycustomdomain" (without .duckdns.org)
TOKEN="CHANGE_ME_TO"     <-- e.g., "a1b2c3d4-..."

(Alternatively, both scripts support passing these values as command-line arguments if you prefer not to hardcode them).


🪟 Windows Usage (duckdns.ps1)

Requirements: PowerShell 7.6+ (pwsh.exe).

Manual Run (Testing)

To test the script and update your IP immediately, simply run it:

.\duckdns.ps1

Automatic Background Installation

To install the script so it runs silently in the background every 5 minutes regardless of who is logged in:

  1. Open PowerShell as Administrator.
  2. Run the script with the -Install switch:
.\duckdns.ps1 -Install

This will create a hidden Scheduled Task running as the SYSTEM account. Logs are written to C:\ddns.log.txt by default.

Advanced / Command-Line Parameters

You can override the hardcoded variables on the fly:

.\duckdns.ps1 -Domain "anotherdomain" -Token "your-token-here" -LogPath "D:\Logs\duckdns.txt"

🐧 Linux / OpenWrt Usage (duckdns.sh)

Requirements: curl or wget, and cron (Standard on almost all Linux/OpenWrt distributions).

Preparation

Make the script executable:

chmod +x ./duckdns.sh

Manual Run (Testing)

Run the script to update the IP and view the output directly in the terminal:

./duckdns.sh

Automatic Background Installation

To install the script into the current user's crontab to run every 5 minutes:

./duckdns.sh --install

(Note: If you want the log file to be saved in /var/log/ddns.log, you must run the installation with sudo, otherwise it will warn you about missing write permissions).

Uninstall Background Task

To safely remove the script from your crontab:

./duckdns.sh --uninstall

Advanced / Command-Line Parameters

The bash script accepts standard flags to override the internal variables:

./duckdns.sh --domain "anotherdomain" --token "your-token-here" --log "/tmp/custom_log.txt"

📜 License & Author

About

DuckDNS Updating Script for both Windows and Linux

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors