Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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


In reply to Dynamic DNS for your GoDaddy domains by stevieb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2024-04-19 10:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found