====== dyndns_update ====== recently i started to use [[http://dyndns.org|DynDNS]] service. to automatically manage IP changes on machine involved i wrote simple shell script. since it is on the router with [[http://www.openwrt.org|OpenWRT]] installed, it includes IP-getting technique required there. new feature is "-f" option to force IP updating. it is a good thing to do so from time to time, to prevent account removal after 30 days. #!/bin/sh USER="username" PASS="topsi_kret" DOMAIN="$USER.dyndns.org" # metchod of getting current IP; this one's valid for OpenWRT/Backfire IP="`ifconfig eth0.1 | grep addr: | sed 's#^ *inet addr:##' | sed 's# .*##'`" # get last set IP LAST_IP_FILE="$HOME/.dyndns_last_ip" touch "$LAST_IP_FILE" LAST_IP="`cat "$LAST_IP_FILE"`" # skip if not changed and not forced [ "$1" != "-f" ] && [ "$LAST_IP" = "$IP" ] && exit 0 # update on change wget -O /dev/null "http://$USER:$PASS@members.dyndns.org/nic/update?hostname=$DOMAIN&myip=$IP&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG" || exit $? echo "$IP" > "$LAST_IP_FILE" exit $? script in raw (i.e. text) form can be obtained here: {{:prjs:dyndns_update.txt|dyndns_update}}.