#!/bin/bash # Script to update dynu.com dynamic hosts # Cron this to run occasionally # Requirements: wget and dig # Limitations: IPv4 only # Script made by Snorkasaurus, last edited 2023-08-30 # https://snork.ca/gitsucks/#dynu-updater # To get MYPWD run # echo -n "YOURPASSWORD" | sha256sum | cut -d " " -f 1 # or paste your password at https://www.dynu.com/en-US/NetworkTools/Hash and hit SHA256 # If you do not want a log, just set MYLOG to "/dev/null" # Modify these variables MYHOST="EXAMPLE.freeddns.org" MYUSER="USERNAME" MYPWD="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" MYLOG="/path/to/${MYHOST}.log" # Modifying these variables is discouraged WANIP=`wget -4 -qO- https://ipinfo.io/ip` DNSIP=`dig +short ${MYHOST} @ns1.dynu.com` APIURL="https://api.dynu.com/nic/update" # Here's the actual work of the script if [ ${DNSIP} != ${WANIP} ]; then echo $(date +%Y)-$(date +%m)-$(date +%d) at $(date +%k):$(date +%M) - ${WANIP} >> ${MYLOG} wget -O /dev/null "${APIURL}?hostname=${MYHOST}&myip=${WANIP}myipv6=no&username=${MYUSER}&password=${MYPWD}" fi