Godaddy update script

This script can update your domain dynamically for godaddy:

#!/bin/bash

domain="prodet.org"   # your domain
name="@"     # name of A record to update
key="akey"      # key for godaddy developer API
secret="asecret"   # secret for godaddy developer API

headers="Authorization: sso-key $key:$secret"

logger "dyndns:" $headers

result=$(curl -s -X GET -H "$headers" \
 "https://api.godaddy.com/v1/domains/$domain/records/A/$name")

dnsIp=$(echo $result | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b")
logger "dyndns: dnsIp:" $dnsIp

# Get public ip address there are several websites that can do this.
ret=$(curl -s GET "http://ipinfo.io/json")
currentIp=$(echo $ret | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b")
logger "dyndns: currentIp:" $currentIp

 if [ $dnsIp != $currentIp ];
 then
logger "dyndns: Ips are not equal"
	request='{"data":"'$currentIp'","ttl":3600}'
logger "dyndns: " $request
	nresult=$(curl -i -s -X PUT \
 -H "$headers" \
 -H "Content-Type: application/json" \
 -d [$request] "https://api.godaddy.com/v1/domains/$domain/records/A/$name")
logger "dyndns: " $nresult
fi

Copy this script to /etc/cron.hourly/dynip file as root.