http://qs321.pair.com?node_id=11143954

With its API, GoDaddy makes it easy to do dynamic DNS updates for your domain's hostnames. I made it easy to do with Perl with Net::DynDNS::GoDaddy (which uses my new Addr::MyIP to get your current external IP address). I'll give an example, then an example use of the distribution's packaged binary script.

use Addr::MyIP; use Net::DynDNS::GoDaddy; my $hostname = 'home'; my $domain = 'example.com'; my $current_host_ip = host_ip_get($hostname, $domain); my $my_ip = myip(); if ($current_host_ip ne $my_ip) { host_ip_set($host, $domain, $my_ip); }

Simple. The library requires a godaddy_api.json file in your home directory (MacOS, Unix or Windows, the software has 100% test coverage on all systems) that looks like this:

{ "api_key" : "api_key", "api_secret" : "api_secret" }

Using the binary we'll install when you install the library, it will prompt you for this information on its initial run:

> update-ip home example.com Please enter your GoDaddy API key and hit ENTER: ...api_key... Please enter your GoDaddy API secret and hit ENTER: ..api_secret... Updated record for 'home.example.com' from x.x.x.x to x.x.x.x

...after the initial run, it won't prompt anymore:

> update-ip home example.com Not updating the 'home.example.com' record, IPs are the same

You can specify the IP if you don't want to use your current public-facing one we automatically get for you:

> update-ip home example.com 10.7.10.2

The most useful use for me is to have multiple hostnames ('home', 'office', 'roaming' etc) and just run the program through cron:

# Home storage server */15 * * * * update-ip home example.com >> /tmp/update-home_cron.log 2 +>&1

My laptop:

*/15 * * * * update-ip roaming example.com >> /tmp/update-roaming_cron +.log 2>&1

Usage:

Usage: update-ip host domain.name [ip.addr]

Have fun!

-stevieb