ddclient

debconf-set-selections <<\EOF
ddclient ddclient/password: (password omitted)
ddclient ddclient/server: members.dyndns.org
ddclient ddclient/protocol: dyndns2
ddclient ddclient/username: user1
ddclient ddclient/names: myname.dyndns.org
ddclient ddclient/interface: web
ddclient ddclient/service: www.dyndns.com
EOF
 
# install
apt-get install -y ddclient
 
# disable demon mode
sed -i 's|run_daemon="true"|run_daemon="false"|g' /etc/default/ddclient
 
# create cron entry
cat <<EOF> /etc/cron.hourly/ddclient
#!/bin/sh
 
HOST=YOUR_HOST.dyndns.org
IP_DNS=\$(ping \${HOST} -c 1 | grep PING | cut -d "(" -f 2 | cut -d ")" -f 1)
IP_WAN=\$(wget http://checkip.dyndns.com/ -q -O - | grep IP | cut -d ":" -f 2 | cut -d "<" -f 1 | tr -d " ")
 
if [ \${IP_DNS} != \${IP_WAN} ]; then
	echo "update dyndns from \${IP_DNS} to \${IP_WAN}"
	ddclient -force
else
	echo "dyndns ok"
fi
EOF
 
# make cron entry executable
chmod a+x /etc/cron.hourly/ddclient
 
 
# LINK
http://ddclient.wiki.sourceforge.net/Usage