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:
Resolve a hostname to IP in a bash script
Find out your router’s external IP address using the Linux command line