commit
52581a87cc
|
@ -39,6 +39,22 @@ dnspod_is_record_updated(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dnspod_is_record_updated2(){
|
||||||
|
options="login_email=${ACCOUNT}&login_password=${PASSWORD}&format=json";
|
||||||
|
out=$(curl -s -k https://dnsapi.cn/Record.List -d "${options}&domain=${DOMAIN}&sub_domain=${SUBDOMAIN}")
|
||||||
|
#echo $out
|
||||||
|
#resolve_ip=$(echo $out | sed 's/.*"value":"\([0-9.]*\)",.*/\1/g')
|
||||||
|
resolve_ip=${out#*value\":\"};
|
||||||
|
resolve_ip=${resolve_ip%%\"*}
|
||||||
|
#current_ip=$(curl -s icanhazip.com)
|
||||||
|
current_ip=$(curl -s ip.xdty.org)
|
||||||
|
echo $resolve_ip
|
||||||
|
echo $current_ip
|
||||||
|
if [ "$resolve_ip" = "$current_ip" ]; then
|
||||||
|
echo "Record updated."
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
|
}
|
||||||
dnspod_domain_get_id(){
|
dnspod_domain_get_id(){
|
||||||
options="login_email=${ACCOUNT}&login_password=${PASSWORD}";
|
options="login_email=${ACCOUNT}&login_password=${PASSWORD}";
|
||||||
out=$(curl -s -k https://dnsapi.cn/Domain.List -d ${options});
|
out=$(curl -s -k https://dnsapi.cn/Domain.List -d ${options});
|
||||||
|
@ -84,7 +100,7 @@ dnspod_update_record_ip(){
|
||||||
main(){
|
main(){
|
||||||
|
|
||||||
dnspod_load_config $1
|
dnspod_load_config $1
|
||||||
dnspod_is_record_updated
|
dnspod_is_record_updated2
|
||||||
dnspod_domain_get_id
|
dnspod_domain_get_id
|
||||||
dnspod_update_record_ip
|
dnspod_update_record_ip
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue