爱意满满的作品展示区。
clanned

cloudxns 动态域名更新 shell 脚本

  •  
  •   clanned · Dec 6, 2015 · 5763 views
    This topic created in 3898 days ago, the information mentioned may be changed or developed.

    源码地址
    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

    7 replies    2016-09-04 17:27:07 +08:00
    lll9p
        1
    lll9p  
       Dec 7, 2015
    在 dnspod 上用 Python 写过一个类似的☺
    wm5d8b
        2
    wm5d8b  
       Dec 7, 2015 via Android
    自己用 Python 写的经常更新 IP 失败,看到这个才想起来应该在更新后校验一下😁
    clanned
        3
    clanned  
    OP
       Dec 7, 2015
    @lll9p 源码地址里也有 dnspod 的动态域名 shell 更新脚本哦,用了很久了,这几天 dnspod 对 8.8.8.8 解析出问题了所以我转到 cloudxns 了
    CloudXNS
        4
    CloudXNS  
       Dec 30, 2015
    赞!~
    感谢楼主分享。
    danili
        5
    danili  
       Mar 28, 2016
    谢谢楼主分享,请问如果我想同时给"@","www","ddns"更新 IP 的花 conf 文件应该如何修改呢?
    clanned
        6
    clanned  
    OP
       Mar 29, 2016   ❤️ 1
    @danili 更新 ddns.example.com, @ 和 www 在 dns 解析里通过 cname 指向到 ddns.example.com
    danili
        7
    danili  
       Sep 4, 2016
    用了挺久了,今天在路由器上刷了 SS 之后发现域名更新到国外服务器上去了....查了下原来用来查询 ip 的这个域名解析成国外的地址出错了。改成一个国内的更稳更快些。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   936 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 22:58 · PVG 06:58 · LAX 15:58 · JFK 18:58
    ♥ Do have faith in what you're doing.