安装luci-app-ddns 后,服务中找不到,用脚本实现
vi /root/ddns
#!/bin/sh -
USER="xxxxx"
PASS="ppppp"
DOMAIN="ooooooooo.wicp.vip"
URL="http://${USER}:${PASS}@ddns.oray.com:80/ph/update?hostname=${DOMAIN}"
if [ -f /tmp/ddns_oray_res ]; then
current_ip=$(ubus call network.interface.wan status | grep \"address\" | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'; )
req=`cat /tmp/ddns_oray_res| 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_oray_res -q ${URL}
chmod a+x /root/ddns
crontab -e
*/1 * * * * /root/ddns