Bash script for Sitelutions.com dyndns

I use sitelutions.com for my websites and subdomains; I love using sitelutions because it’s the best free solution I found for my servers with dynamic IPs. The only problem is that there’s not very many dyndns update clients available. So, I tried my hand at scripting and this is what I’ve come up with.

#!/bin/sh

#### SITELUTIONS DYNDNS UPDATE SCRIPT ####

USERNAME="email"
PASSWORD="password"

#Separate record ids by a comma

RECORDIDS="1234567"
TTL="60"

LOGFILE="/var/log/sitelutions.log"

### Ways to retrieve IP address ##

##(Default) use sitelutions
IP="&detectip=1"

##Retrieve from external site (HTTP)
##icanhazip.com (alternatives: ipid.shat.net/iponly, whatismyip.com, etc)
#IP=`wget -O – -q icanhazip.com`

##existing domain IP
#IP=`nslookup domain.com | grep Add | grep -v ‘#’ | cut -f 2 -d ‘ ‘`

#Build https request
REQUEST="https://www.sitelutions.com/dnsup?user=$USERNAME&pass=$PASSWORD&id=$RECORDIDS&ip=$IP&ttl=$TTL"
OUTPUT=`wget -O – -q $REQUEST`

LOG=`date +%c`" "$OUTPUT
echo $LOG >> $LOGFILE

Update: You can also download the script file here as plain text. Note: If you use this template you need to make the script file executable.

Once you’ve confirmed that this works you can simply throw it in as a cronjob that runs every 30 minutes or so.

Hope this is helpful to anyone else using sitelutions! Bash scripting is pretty cool, I’m definitely going to use it more. If you have any tips on how to improve the script feel free to comment.

Resources:

Sitelutions PHP Script

Resolve a hostname to IP in a bash script

Find out your router’s external IP address using the Linux command line

HOWTO: Check you external IP Address from the command line

Append Line to a File

string concatenation in bash

This entry was posted in Project, Sheevaplug and tagged , , . Bookmark the permalink.

4 Responses to Bash script for Sitelutions.com dyndns

  1. Julie says:

    Again, you’re intelligence amazes me. Don’t worry, I won’t call you a nerd. You’re just smart is all.

  2. Julie says:

    *”your” not “you’re”… apparently my intelligence is still lacking.

  3. Sitelutions says:

    Hello,

    That’s a good script! We’re adding your script to the list of Dynamic DNS clients on our website, and it should be live by the end of the day today (after a couple rounds of testing, of course).

    As for suggestions: you could include a simple if/then statement to check multiple sources for the IP address, and compare them to each other. If they come out “in agreement”, it can then move forward and publish the change.

    Keep up the good work!

  4. dcrin3 says:

    Nice solutions to dynamic dns, adding to cronjob as well.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>