源码地址
https://github.com/xdtianyu/scripts/tree/master/ddns
可用于 ddwrt 和 openwrt 路由,只需要 sh 运行(系统基本环境)
下载 shell 脚本
wget https://raw.githubusercontent.com/xdtianyu/scripts/master/ddns/cloudxns.sh
wget https://raw.githubusercontent.com/xdtianyu/scripts/master/ddns/cloudxns.conf
chmod +x cloudxns.sh
配置文件
API_KEY="YOUR_API_KEY"
SECRET_KEY="YOUR_SECRET_KEY"
DOMAIN="example.com"
HOST="ddns"
LAST_IP_FILE="/tmp/.LAST_IP"
cron 定时任务
*/3 * * * * /root/ddns/cloudxns.sh /root/ddns/cloudxns.conf >> /root/ddns/cloudxns.log
脚本会在更新成功后记录 ip ,只有当 ip 变化后才会再运行更新
更详细的说明在我的博客 https://www.xdty.org/1907