Giter VIP home page Giter VIP logo

Comments (12)

honwen avatar honwen commented on August 10, 2024

已存在的记录 程序没办法知道你哪些要哪些不要 啊。 程序怎么敢乱删

from luci-app-aliddns.

islercn avatar islercn commented on August 10, 2024

我在name.com上有一个域名,也容易出现这个问题,我没有一个域名多个IP的需求(估计绝大多数人也没有吧),因此我在脚本里的处理方式是每次获取一次子域名对应的记录条数,然后遍历一遍,全部删掉,再添加新的,当然也可能遍历时某条删除失败,可以尝试删除多次,当然一般也不会那么点背总出问题吧

from luci-app-aliddns.

honwen avatar honwen commented on August 10, 2024

我自己就有子域名的需要,再说,用不到的子域名就由它在那里就好了

from luci-app-aliddns.

honwen avatar honwen commented on August 10, 2024

我的想法是:一个程序只做一件事,不能越俎代庖

from luci-app-aliddns.

islercn avatar islercn commented on August 10, 2024

没问题的啊,就是在更新当前子域名的时候,保证只存在一个正确的IP啊,多条IP本来就是之前更新带来的,按理说本来就应该处理掉

from luci-app-aliddns.

honwen avatar honwen commented on August 10, 2024

那不会出现一个子域名对应多个IP的情况,没遇过,具体情况是?

from luci-app-aliddns.

islercn avatar islercn commented on August 10, 2024

我没太看阿里的api,我用name.com的api时,是通过api获取对应子域名的解析记录ID,然后根据这个ID删除旧的记录,再添加新的。但是用curl的时候偶尔会超时,导致删除失败,如果接下来添加记录又成功了,那就会出现两条解析记录了,以后更新的时候因为也只是删一条,所以记录就会越来越多。

没仔细看阿里的api,是不是差不多呢,网络不好,或者在插件配置页面点了多次应用,然后阴差阳错,机缘巧合,就会导致添加多条解析记录了

from luci-app-aliddns.

honwen avatar honwen commented on August 10, 2024

阿里的API, 一个域名对应一个值,这里是A值,这程序只会在(不存在这个子域名)的时候去添加,已存在只会修改。

from luci-app-aliddns.

islercn avatar islercn commented on August 10, 2024

比如办公室里的一台刷了x86 lede的软路由,这几天由于上层交换机故障,IP频繁变化,还时不时断网,然后就出现了多条记录

https://i.loli.net/2018/01/18/5a608afe7fcdb.png

from luci-app-aliddns.

honwen avatar honwen commented on August 10, 2024

我测试一下

from luci-app-aliddns.

islercn avatar islercn commented on August 10, 2024

关于解析遗留的问题,我测试基本是和SignatureNonce相关的,同时也不用全删,所以我建议改成这样:

do_ddns_record() {
if uci_bool_by_name base clean ; then
query_recordid | get_recordid | while read rr; do
if [ "Z$rr" != "Z$rrid" ]; then
echo "$DATE Clean record $sub_dm.$main_dm: $rr"
suffix=awk -v min=1000 -v max=9999 'BEGIN{srand(); print int(min+rand()*(max-min+1))}'
timestamp=$(date -u "+%Y-%m-%dT%H%%3A%M%%3A%SZ")$suffix
del_record $rr >/dev/null
fi
done
fi
suffix=awk -v min=1000 -v max=9999 'BEGIN{srand(); print int(min+rand()*(max-min+1))}'
timestamp=$(date -u "+%Y-%m-%dT%H%%3A%M%%3A%SZ")$suffix
rrid=query_recordid | get_recordid
suffix=awk -v min=1000 -v max=9999 'BEGIN{srand(); print int(min+rand()*(max-min+1))}'
timestamp=$(date -u "+%Y-%m-%dT%H%%3A%M%%3A%SZ")$suffix
if [ "Z$rrid" == "Z" ]; then
rrid=add_record | get_recordid
echo "$DATE ADD record $rrid"
else
update_record $rrid >/dev/null 2>&1
echo "$DATE UPDATE record $rrid"
fi
if [ "Z$rrid" == "Z" ]; then
# failed
echo "$DATE # ERROR, Please Check Config/Time"
else
# save rrid
uci set aliddns.base.record_id=$rrid
uci commit aliddns
echo "$DATE # UPDATED($ip)"
fi
}

from luci-app-aliddns.

honwen avatar honwen commented on August 10, 2024

@islercn please make a pull request

from luci-app-aliddns.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.