DynDNS have added a new stipulation to their free dynamic domain name accounts that you must log in to the site at least once a month; otherwise, you will lose your account.
Not being a fan of doing things manually, I took the lazy pragmatic approach and wrote a script to do it for me. It's designed to be run under a Heroku instance.
It also will email you when the script breaks for any reason. This application is for educational purposes only - I can't guarantee that it will actually count as an official login for DynDNS's purposes, but so far it seems to work for me
-
Install the Heroku Bootstrap / Ruby if you haven't done so already. Make sure to install the gem bundler if you haven't already
gem install bundler
-
Download the script
git clone https://github.com/shaunmccarthy/DynDNS.git
-
Configure it to run locally
Note: on some systems, you need to use
export
, notset
.set dyndns_username=yourdyndnsusername
set dyndns_password=yourdyndnspasswordIf you want to be emailed whenever there is an error:
set error_email_from=[email protected]
set error_email_from_password=notyourmainaccountunlessyoulikebeinghacked
set error_email_to=[email protected] -
Install the package locally (make sure you have installed the bundler first)
bundle install
You might need to comment out the gem "psych" line in Gemfile to get it to run locally. You will need to put it back in before deploying to Heroku as they use syck by default to parse yaml.
-
Test it locally with
ruby dyndns_login.rb
-
Optional: add a
.bash
file where you set the environment variables, and start if from crontab.Weekly crontab entry (edit using
crontab -e
):@weekly /bin/bash ~/dyndns_login.bash
~/dyndns_login.bash
file:#!/bin/bash #http://www.thegeekstuff.com/2011/07/cron-every-5-minutes/ #http://stackoverflow.com/questions/15557777/crontab-job-does-not-get-the-environment-variables-set-in-bashrc-file export dyndns_username=foo export dyndns_password=baz ruby ~/DynDNS/dyndns_login.rb
-
Create a Heroku account
-
Follow the quick start to get your account up and running here
Note where the public key is generated, as you may need this if you get the dreaded "Permission denied (publickey)." error.
See http://stackoverflow.com/questions/4269922/permission-denied-publickey-when-deploying-heroku-code-fatal-the-remote-end for more details. ssh-keygen can be found in C:\program files\git\bin
-
Push the code to Heroku
git push heroku master
This is where you might come across the SSH error above - follow the instructions in the stack overflow article
-
Set the environment variables
heroku config:set dyndns_username=yourdyndnsusername
heroku config:set dyndns_password=yourdyndnspasswordIf you want to be emailed whenever there is an error:
heroku config:set error_email_from=[email protected]
heroku config:set error_email_from_password=notyourmainaccountunlessyoulikebeinghacked
heroku config:set error_email_to=[email protected] -
Test the code on Heroku
heroku run ruby dyndns_login.rb
-
Add the scheduler plugin
heroku addons:add scheduler:standard
You might need to validate your account since you potentially could go over your free limit depending on how often you run this (very very unlikely though). Use at own risk :)
-
Open the scheduler screen
heroku addons:open scheduler
-
Schedule the task to happen daily
$ ruby dyndns_login.rb
Sit back and wait for it to run :)
Any questions, email me at [email protected]