Updating Namecheap DDNS using BASH, CURL, and good 'ol know how.

I have a server at home that I use to do snapshot style backups using rsync. As such, I'd like to be able to connect to it from time to time when not at home. This is a simple way to update your Dynamic DNS with NameCheap.

Create a file called ddns and place it in /etc/cron.daily and set the permissions to 700

#!/bin/bash
# Update NameCheap DDNS 
 
# Disclaimer: I have no affiliation with jackson.io, it may not work when you read this.  
# It's just fetching your URL as plain text.  If you had a webserver it would be simple
# to write your own whatismyip service.
IP=$(exec wget -q -O - <a href="http://jackson.io/ip/" title="http://jackson.io/ip/">http://jackson.io/ip/</a>)
 
curl -s -o temp.html "http://dynamicdns.park-your-domain.com/update?domain=YOURDOMAINNAME&password=YOURVERYLONGPASSWORDFROMNAMECHEAP&host=YOURHOSTNAME&ip=${IP}"

You'll want to change some of the variables in the long URL. After that, it will update NameCheap DDNS on a nightly basis. No more need for a static IP.

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <drupal5>, <drupal6>, <javascript>, <php>, <sql>. Beside the tag style "<foo>" it is also possible to use "[foo]".

More information about formatting options