Last active
October 8, 2024 01:18
-
-
Save 599316527/f802c7b908f7c33aa594 to your computer and use it in GitHub Desktop.
asuswrt-merlin custom ddns script for dnspod
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This file should be placed in /jffs/scripts/ folder. | |
# 后台申请token | |
# https://support.dnspod.cn/Kb/showarticle/tsid/227/ | |
login_token='xxxxxxx,yyyyyyyyyyyyyyyyyyyyyyyyyyyyy' | |
# 先调 Domain.List 和 Record.List 接口取得 id | |
# https://www.dnspod.cn/docs/domains.html#domain-list | |
# https://www.dnspod.cn/docs/records.html#record-list | |
domain_id='12345678' | |
record_id='987654321' | |
################################################################ | |
api_url='https://dnsapi.cn/Record.Modify' | |
log_path='/tmp/ddns-start.log' | |
sub_domain='www' | |
value="$1" | |
record_type='A' | |
record_line='%E9%BB%98%E8%AE%A4' # 默认 | |
form_data="format=json\ | |
&login_token=${login_token}\ | |
&domain_id=${domain_id}\ | |
&record_id=${record_id}\ | |
&sub_domain=${sub_domain}\ | |
&value=${value}\ | |
&record_type=${record_type}\ | |
&record_line=${record_line}" | |
curl -v -d $form_data -o $log_path $api_url | |
if [ $? -eq 0 ]; then | |
/sbin/ddns_custom_updated 1 | |
else | |
/sbin/ddns_custom_updated 0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment