PDA

View Full Version : Automatic ddclient updates


lull
10-14-2003, 06:00 PM
when i had 10.2 installed i had figured out a way to get ddclient to automatically update my dyndns address when i plugged in my network cable, which, needless to say, is very handy. sure, it's easy to open up a term and type "sudo ddclient", then enter your password, but it's easier to not do it. when i installed 10.3 it overwrote my customizations and i was left having to bother with the terminal. today i'd had enough, so i figured out the changes i'd made by grepping an old backup, and i thought i'd share them with everybody here. i don't know that this is the best way to do it, but it's been working for me for several months.

first off, you have to have ddclient installed. i'm pretty sure i did this with fink, but ddclient is just a set of perl scripts so it's really not too hard to do it yourself some other way. i'm not going to bother getting into how to install it here, having it already installed is a prerequisite, and this isn't too in-depth anyhow.

the real changes are here:

make sure you have administrator rights (sudo, su or root login) and open the following file in your favorite editor... (vim, right? ;-)

/System/Library/SystemConfiguration/Kicker.bundle/Contents/Resources/set-hostname

down towards the bottom, but above the "exit 0" line at the bottom, insert the following code...


#
# set dyndns hostname
#

ddc=$(/usr/sbin/ddclient)

if [ -f ${ddc} ]; then
if [ ! "${ddc} | grep SUCCESS" == "" ]; then
logger ddclient update via 'set-hostname' succeeded, w00t.
fi
fi


of course, you'll want to replace the location variable for ddclient. do this by running "which ddclient" at a terminal.

from now on when you plug in your network adapter it should automatically run ddclient for you, and if you already had it configured properly then it will automatically update your dyndns address. if you'd like to see the progress, you can always "tail -f /var/log/system" and watch while you unplug your ethernet cable, then plug it back in.