作者:hzl88688 | 更新时间:2016-03-06 | 浏览量:2108
#!/bin/ash
shPath=$(cd `dirname $0`; pwd)
ip_regex="[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}"
myip=$(echo $( wget -O - http://ddns.nat123.com 2>/dev/null) | grep -o "$ip_regex")
myOldIp=$(cat ${shPath}/oldIp.txt)
if [ $3 ]
then
param3=$3
else
param3=80
fi
if [ ${myip} = ${myOldIp} ]
then
exit
else
wget -o ${shPath}/status.txt http://www.bigiot.net/Dns/updateDns?id=$1\&ip=${myip}\&pw=$2\&pt=${param3}
status=$(cat ${shPath}/status.txt)
echo $myip > ${shPath}/oldIp.txt
echo ${status}
fi