Update script DNS-O-Matic V0.2
2008 April 1
I have updated the
DNS-O-Matic update script to now check whether the update was
successfully or not. If it’s not successful the IP doesn’t get changed
in the temp file. You can download version 0.2 of my update script here or copy the code:
#!/bin/bash#For all domainnamesHOSTNAME="all.dnsomatic.com"#For a single one#HOSTNAME="example.com"USER="username"PASS="password"IP=$(curl -s http://myip.dk/ | egrep -m1 -o '[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}')if [ -r "/tmp/oldip.DNS-O-Matic" ]; thenOLDIP=`cat /tmp/oldip.DNS-O-Matic`if [ "$OLDIP" = "$IP" ]; thenexit 0elseRETURN=$(curl -s https://${USER}:${PASS}@updates.dnsomatic.com/nic/update?hostname=${HOSTNAME}&myip=$IP&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG)echo "Return message of DNS-O-Matic : " $RETURNecho $RETURN | grep "good" > /dev/null 2>&1if [ "$?" -eq "0" ]; thenecho $IP > /tmp/oldip.DNS-O-Maticelseecho "" > /tmp/oldip.DNS-O-Maticfififi
One Response
leave one →
Thank U!