| Line 12: |
Line 12: |
| | | | |
| | # Your DuckDNS token | | # Your DuckDNS token |
| − | TOKEN="your-duckdns-token" | + | TOKEN="********-****-****-****-************" |
| | | | |
| | # List of your DuckDNS subdomains | | # List of your DuckDNS subdomains |
| − | DOMAINS=("flirt" "zr0ke" "r0942") | + | DOMAINS=("r0942" "zr0ke" "labelbosque") |
| | | | |
| | # Optional: IP address to set (leave empty to use external IP) | | # Optional: IP address to set (leave empty to use external IP) |
| Line 21: |
Line 21: |
| | | | |
| | # Log file | | # Log file |
| − | LOGFILE="$HOME/duckdns_update.log" | + | LOGFILE="$HOME/duckdns/update.log" |
| | | | |
| − | # Logging function
| |
| | log() { | | log() { |
| | local message="$1" | | local message="$1" |
| Line 31: |
Line 30: |
| | } | | } |
| | | | |
| − | # Loop through domains
| |
| | for DOMAIN in "${DOMAINS[@]}"; do | | for DOMAIN in "${DOMAINS[@]}"; do |
| | + | if [ -z "$DOMAIN" ]; then |
| | + | log "Skipped empty domain entry" |
| | + | continue |
| | + | fi |
| | + | |
| | URL="https://www.duckdns.org/update?domains=${DOMAIN}&token=${TOKEN}&ip=${IP}" | | URL="https://www.duckdns.org/update?domains=${DOMAIN}&token=${TOKEN}&ip=${IP}" |
| − | RESPONSE=$(curl -s "$URL") | + | RESPONSE=$(curl -s --fail "$URL") || RESPONSE="curl_error" |
| | | | |
| | if [ "$RESPONSE" == "OK" ]; then | | if [ "$RESPONSE" == "OK" ]; then |
| Line 42: |
Line 45: |
| | fi | | fi |
| | done | | done |
| | + | |
| | | | |
| | </syntaxhighlight> | | </syntaxhighlight> |
| Line 55: |
Line 59: |
| | ==/etc/ddclient.conf example== | | ==/etc/ddclient.conf example== |
| | <nowiki>## ddclient configuration file | | <nowiki>## ddclient configuration file |
| − | daemon=600
| + | daemon=600 |
| − | # check every 600 seconds
| + | # check every 600 seconds |
| − | syslog=yes
| + | syslog=yes |
| − | # log update msgs to syslog
| + | # log update msgs to syslog |
| − | mail-failure=redteam@bbva.com # Mail failed updates to user
| + | mail-failure=redteam@bbva.com # Mail failed updates to user |
| − | pid=/var/run/ddclient.pid
| + | pid=/var/run/ddclient.pid |
| − | # record PID in file.
| + | # record PID in file. |
| − | ssl=yes
| + | ssl=yes |
| − | # use HTTPS
| + | # use HTTPS |
| − | ## Detect IP with our CheckIP server
| + | ## Detect IP with our CheckIP server |
| − | use=web, web=checkip.dyndns.com/, web-skip='IP Address'
| + | use=web, web=checkip.dyndns.com/, web-skip='IP Address' |
| − | ## DynDNS username and password here
| + | ## DynDNS username and password here |
| − | login=RedTeam
| + | login=RedTeam |
| − | password=##YOUR PASSWORD##
| + | password=##YOUR PASSWORD## |
| − | ## Default options
| + | ## Default options |
| − | protocol=dyndns2
| + | protocol=dyndns2 |
| − | server=members.dyndns.org
| + | server=members.dyndns.org |
| − | ## Dynamic DNS hosts
| + | ## Dynamic DNS hosts |
| − | rrafara.dyndns.org</nowiki>
| + | rrafara.dyndns.org</nowiki> |
| | | | |
| | Restart ddclient service | | Restart ddclient service |