#!/bin/bash
domain=my-tm.kozow.com
oldip=`dig +short $domain`
#echo $oldip
newip=`curl -s ip.sb -4`
if [[ $newip != $oldip ]] && [[ $newip =~ "." ]]  && [[ $oldip =~ "." ]] 
then
	# -n 不换行输出
	echo -n "$oldip —> "
	curl -s "https://api.dynu.com/nic/update?hostname=$domain&ip=$newip&password=2grY9PqQJp"
	echo ' - '`date +"%Y-%m-%d %H:%M:%S"`
fi
