新加入基友 欢迎骚扰
分享一个自己写的脚本吧,根据dnspod开发平台写的脚本实现ddnsUSERID=""TOKEN=""
DOMAIN=""
SUBDOMAIN=""
DOMAIN_ID=""
RECORD_LIST=""
i=0;
current_ip=$(nc ns1.dnspod.net 6666)
dnspod_domain_get_id(){
options="login_token=${USERID},${TOKEN}";
out=$(curl -s -k https://dnsapi.cn/Domain.List -d ${options});
for line in $out;do
if [ $(echo $line|grep '<id>' |wc -l) != 0 ];then
DOMAIN_ID=${line%<*};
DOMAIN_ID=${DOMAIN_ID#*>};
#echo "domain id: $DOMAIN_ID";
fi
if [ $(echo $line|grep '<name>' |wc -l) != 0 ];then
DOMAIN_NAME=${line%<*};
DOMAIN_NAME=${DOMAIN_NAME#*>};
#echo "domain name: $DOMAIN_NAME";
if [ "$DOMAIN_NAME" = "$DOMAIN" ];then
break;
fi
fi
done
out=$(curl -s -k https://dnsapi.cn/Record.List -d "${options}&domain_id=${DOMAIN_ID}")
for line in $out;do
if [ $(echo $line|grep '<id>' |wc -l) != 0 ];then
RECORD_ID=${line%<*};
RECORD_ID=${RECORD_ID#*>};
#echo "record id: $RECORD_ID";
fi
if [ $(echo $line|grep '<name>' |wc -l) != 0 ];then
RECORD_NAME=${line%<*};
RECORD_NAME=${RECORD_NAME#*>};
#echo "record name: $RECORD_NAME";
if [ "$RECORD_NAME" = "$SUBDOMAIN" ];then
break;
fi
fi
done
echo "$RECORD_NAME:$RECORD_ID"
}
dnspod_update_record_ip(){
curl -k https://dnsapi.cn/Record.Ddns -d "login_token=${USERID},${TOKEN}&domain_id=${DOMAIN_ID}&record_id=${RECORD_ID}&sub_domain=${RECORD_NAME}&record_line=默认"
}
main(){
dnspod_domain_get_id
dnspod_update_record_ip
}
main
欢迎欢迎,感谢分享 介绍一下具体用法{:7_202:} 群晖不是有腾讯的DDNS吗,还需要自己写? 超导体 发表于 2018-9-6 23:23
介绍一下具体用法
好的 过两天我来写一个定时ddns的教程
页:
[1]