Skip to content

Instantly share code, notes, and snippets.

@NaanProphet
Last active February 19, 2025 10:17
Show Gist options
  • Save NaanProphet/124c28368ad0f075ca93 to your computer and use it in GitHub Desktop.
Save NaanProphet/124c28368ad0f075ca93 to your computer and use it in GitHub Desktop.
DuckDNS shell script for Asus Merlin Routers
Tested on an ASUS RT-AC56U running Merlin firmware 378.55
#!/bin/sh
### location: anywhere, preferably outside the jffs partition on an external flash drive
### because the jffs partition ROM has a limited number of writes.
### ensure this file has execute permissions
# the name of your sub-domain on duckdns.org
DOMAIN=
# your private token
TOKEN=
touch /tmp/000duckdnsstarted
echo url="https://www.duckdns.org/update?domains=${DOMAIN}&token=${TOKEN}&ip=" | curl -k -o
#!/bin/sh
### location: /jffs/scripts/
### ensure this file has execute permissions
# path to bash script to talk to DuckDNS servers
REFRESH_SCRIPT=/mnt/OPTWARE/duckdns/duck.sh
# add duckdns refresh to crontab
cru a duckdns "5 * * * * ${REFRESH_SCRIPT} >/dev/null 2>&1"
@OTonGitHub
Copy link

It already can be forced to refresh to every 1 day, I think a cron job is not necessary here.
Moreover, on your script, there is no mention of passing the IP.

It can be passed as a variable IP=$1 from the ddns-start script to the .sh file you have maybe on a USB or in the same folder,
or make a call to a service like akamai (or refer this list https://openwrt.org/docs/guide-user/services/ddns/client#detecting_wan_ip)
to grab your public IP in case device is behind a NAT (i.e., acting as an AP).

Could you also provide me a source to jffs partition ROM have minimal write cycles? A bit paranoid about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment