User Tools

Site Tools


linux:bash:dtdns-ip-update-client

Bash: DtDns IP update client

A simple bash script to keep updated DtDns, the best free dynamic DNS service I know of.

#!/bin/bash
 
# RS UPDATER 1.1.0
# http://www.riksoft.it/wikiriks/linux/bash/dtdns-ip-update-client
# MIT licence
 
#--------- CONFIG ---------------------------
MYHOST="yourhost.darktech.org";
MYPSW="accountPass";
#--------------------------------------------
 
 
IPNEW=`wget -qO- icanhazip.com`;
IPOLD=$(cat "updatednt.dat" 2> /dev/null);
echo $IPOLD;
 
if [ "$IPNEW" != "" ]; then
    echo $IPNEW > updatednt.dat; 
 
    if [ "$IPNEW" != "$IPOLD" ]; then
        wget -q -O /dev/null --user-agent="RSUpdater/1.0" \
            --header="Host:www.dtdns.com" \
            "http://www.dtdns.com/api/autodns.cfm?id=$MYHOST&pw=$MYPSW&client=RSUPDATER_1.1&ip=$IPNEW"
        echo "IP changed from $IPOLD to $IPNEW"
    else
        echo "Unchanged IP $IPNEW"
    fi
fi
linux/bash/dtdns-ip-update-client.txt · Last modified: 2017/08/28 12:31 by rik