北京联通宽带打电话跟联通申请了公网ip,想跟自己的域名进行绑定,但是公网ip在重新拨号后会变化,所以写了如下脚本自动更改公网ip
感谢dragon2k的博客,添加到crontab中即可
腾讯云DNS解析api地址 https://cloud.tencent.com/document/product/302/4032
#!/bin/bash
domain='你的域名,例如qq.com'
subDomain='你希望解析的子域名,例如www.qq.com,则只输入www,腾讯云域名解析列表中的主机记录'
sId='你的云API秘钥SecretId'
sKey='你的云API秘钥SecretKey'
function getId(){
signatureMethod='HmacSHA1'
timestamp=`date +%s`
nonce=`head -200 /dev/urandom | cksum | cut -f2 -d" "`
region=bj
url="https://cns.api.qcloud.com/v2/index.php"
#获取域名解析条目ID:recordId
action='RecordList'
recordType='A'
src=`printf "GETcns.api.qcloud.com/v2/index.php?Action=%s&Nonce