在/etc/cron.hourly里创建oray.sh,并且将权限改成777

编辑oray.sh将里面的内容修改成:

USER="你的花生壳用户名"

PASS="你的密码"

DOMAIN="你的二级域名"

URL="http://${USER}:${PASS}@ddns.oray.com:80/ph/update?hostname=${DOMAIN}&myip=${IP}"


wget -O /tmp/curr_ip.txt -q http://ddns.oray.com/checkip

IP=`cat /tmp/curr_ip.txt | awk -F ":" '{print $2}' | awk -F "\<" '{print $1}'`


if [ -f /tmp/last_ip/txt ]; then

  old_ip=`cat /tmp/last_ip.txt | awk '{ print $2}'`

  if [ "${old_ip}" == "${IP}" ]; then

    exit

  fi

fi

wget -O /tmp/last_ip.txt -q ${URL}