File tree 1 file changed +14
-0
lines changed
1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ mydomain=" Your-Domain-Name-Here.com"
3
+ myhostname=" @"
4
+ gdapikey=" Your-Godaddy-API-Key-Goes-Here"
5
+ logdest=" local7.info"
6
+ myip=` curl -s " https://api.ipify.org" `
7
+ dnsdata=` curl -s -X GET -H " Authorization: sso-key ${gdapikey} " " https://api.godaddy.com/v1/domains/${mydomain} /records/A/${myhostname} " `
8
+ gdip=` echo $dnsdata | cut -d ' ,' -f 1 | tr -d ' "' | cut -d " :" -f 2`
9
+ echo " ` date ' +%Y-%m-%d %H:%M:%S' ` - Current External IP is $myip , GoDaddy DNS IP is $gdip "
10
+ if [ " $gdip " != " $myip " -a " $myip " != " " ]; then
11
+ echo " IP has changed!! Updating on GoDaddy"
12
+ curl -s -X PUT " https://api.godaddy.com/v1/domains/${mydomain} /records/A/${myhostname} " -H " Authorization: sso-key ${gdapikey} " -H " Content-Type: application/json" -d " [{\" data\" : \" ${myip} \" }]"
13
+ logger -p $logdest " Changed IP on ${hostname} .${mydomain} from ${gdip} to ${myip} "
14
+ fi
You can’t perform that action at this time.
0 commit comments