Last active
July 18, 2025 20:21
-
-
Save coffeejoshua/69d2802ab579839ab6f30c5c75f99e82 to your computer and use it in GitHub Desktop.
A bash client to update Dynamic DNS (such as duckdns)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Designed to be invoked every 5 minutes by cron | |
| # See: https://www.duckdns.org/install.jsp | |
| # crontab -e | |
| # */5 * * * * /home/rpi/duckdns/update-duck.sh >/dev/null 2>&1 | |
| MYDOMAIN='your-sub-domain' | |
| TOKEN='your-token' | |
| LOGFILE='/home/rpi/duckdns/duck-history.log' | |
| TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S') | |
| RESPONSE=$(curl -s "https://www.duckdns.org/update?domains=${MYDOMAIN}&token=${TOKEN}&ip=") | |
| if [ "$RESPONSE" = "OK" ]; then | |
| echo "$TIMESTAMP - successful" >> "${LOGFILE}" | |
| else | |
| echo "$TIMESTAMP - failed: $RESPONSE" >> "${LOGFILE}" | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment