在/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}