2020-04-20 14:55:18
浏览数 (1)
修改解析记录
代码语言:javascript
复制#!/bin/bash
#/usr/bin/ddns
recordId='根据上面返回结果,手工填入,好像是几位数字'
domain='你的域名,例如qq.com'
subDomain='你希望解析的子域名,例如wx.qq.com,则只输入wx'
sId='你的云API秘钥SecretId'
sKey='你的云API秘钥SecretKey'
signatureMethod='HmacSHA1'
timestamp=`date %s`
nonce=`head -200 /dev/urandom | cksum | cut -f2 -d" "`
region=bj
url="https://cns.api.zijiebao.com/v2/index.php"
#获取ip
ip=`curl http://2019.ip138.com/ic.asp >/dev/null|iconv -fgb2312 -t utf-8 |sed 's/.*[(.*)].*/1/g'`
action='RecordModify'
recordType='A'
recordLine='默认'
value=$ip
timestamp=`date %s`
nonce=`head -200 /dev/urandom | cksum | cut -f2 -d" "`
src=`printf "GETcns.api.zijiebao.com/v2/index.php?Action=%s&Nonce=%s&Region=%s&SecretId=%s&SignatureMethod=%s&Timestamp=%s&domain=%s&recordId=%s&recordLine=%s&recordType=%s&subDomain=%s&value=%s" $action $nonce $region $sId $signatureMethod $timestamp $domain $recordId $recordLine $recordType $subDomain $value`
#echo 'src: ' $src
signature=`echo -n $src|openssl dgst -sha1 -hmac $sKey -binary |base64`
#echo 'signature: ' $signature
params=`printf "Action=%s&Nonce=%s&Region=%s&SecretId=%s&SignatureMethod=%s&Timestamp=%s&domain=%s&recordId=%s&recordLine=%s&recordType=%s&subDomain=%s&value=%s" $action $nonce $region $sId $signatureMethod $timestamp $domain $recordId $recordLine $recordType $subDomain $value`
#echo 'params: ' $params
curl -G -d "$params" --data-urlencode "Signature=$signature" "$url"
定时更新任务
代码语言:javascript
复制#每隔10分钟更新一次 */
10 * * * * ddns >/dev/null 2>&