From Blink
#!/bin/sh
#---------------------------------------------#
# Simple DYNDNS with MyDNS #
# by Miljan Karadzic - http://www.miljan.org/ #
#---------------------------------------------#
# Change this to suite your configuration
SUB="subdomain" # Name of your subdomain
DOMAIN="example.com" # Name of your domain
FILE=/usr/local/etc/dyndns.conf # File where we to save IP information
#
SERVER="www.example.com" # DNS/Web server
USER="web_user" # Username for web authentication
PASS="web_password" # Password for web authentication
SRV_FOLDER=".secret_folder" # Folder with Dynamic DNS script
SRV_FILE="dyndns.php" # Name of PHP Dynamic DNS script
#
SECRET="some_ultra_mega_giga_secret_string" # Secret string; this has to be the same as the
# secret string on the DNS server; you can do
# md5sum on some random file to generate one
#################################################
# !!!! DO NOT EDIT BELOW THIS LINE !!!! #
#################################################
#
# Connectivity check and IP information retrival
/usr/bin/wget --user=${USER} --password=${PASS} -O /tmp/dyndns$$ \
https://${SERVER}/${SRV_FOLDER}/${SRV_FILE}?addr=${SECRET} >/dev/null 2>&1
if [ "$?" = "0" ]; then
# Check to see if IP is changed
if [ "x$(/bin/cat ${FILE} 2>/dev/null)" != "x$(/bin/cat /tmp/dyndns$$)" ]; then
# Change the IP if it is changed
/usr/bin/wget --user=${USER} --password=${PASS} -O /dev/null \
"https://${SERVER}/${SRV_FOLDER}/${SRV_FILE}?addr=${SECRET}&sub=${SUB}&domain=${DOMAIN}" \
>/dev/null 2>&1
/bin/cat /tmp/dyndns$$ >${FILE}
fi
fi
rm -f /tmp/dyndns$$