关于通过脚本实现动态更新 Oray的方法 拿来和大家分享
首先 我们需要在 /ect/hotplug.d/iface/ 下建立一个文件 25-Oray 在文件内写入如下代码
#!/bin/sh - USER="UserName" PASS="Password" DOMAIN="domin.vicp.net" URL="http://${USER}:${PASS}@ddns.oray.com:80/ph/update?hostname=${DOMAIN}" if [ -f /tmp/ddns ]; then current_ip=$(uci -P /var/state get network.wan.ipaddr) req=`cat /tmp/ddns| grep "${current_ip}"` if [ ! -z "${req}" ]; then old_ip=`echo ${req}| awk '{ print $2}'` if [ "${old_ip}" = "${current_ip}" ]; then exit fi fi fi wget -q -O /tmp/ddns -q ${URL}
然后退出 并且赋予此文件可执行权限
chmod a+x /etc/hotplug.d/iface/25-Oray
再编辑 vi etc/crontabs/root 文档 添加
*/1 * * * * /etc/hotplug.d/iface/25-Oray start
这样就可以了 然后任务会 每隔1分钟执行一次 如果想延长时间可以更具需求修改数据即可.
亲测已经实现