添加 ddns.sh
This commit is contained in:
parent
3803437760
commit
60335822f9
25
ddns.sh
Normal file
25
ddns.sh
Normal file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 你的Cloudflare API密钥
|
||||
API_KEY="your_cloudflare_api_key"
|
||||
# 你的Cloudflare Email地址
|
||||
EMAIL="your_email@example.com"
|
||||
# 你想要更新的DNS记录的ID
|
||||
RECORD_ID="your_dns_record_id"
|
||||
# 你的Cloudflare zone ID
|
||||
ZONE_ID="your_zone_id"
|
||||
# 你的域名
|
||||
DOMAIN="your_domain.com"
|
||||
# 你的子域名
|
||||
SUBDOMAIN="sub.your_domain.com"
|
||||
|
||||
# 从use/use.txt文件中读取IP地址
|
||||
while IFS= read -r ip
|
||||
do
|
||||
# 使用Cloudflare API更新DNS记录
|
||||
curl -X PUT "https://api.cloudflare.com/client/v4/zones/${ZONE_ID}/dns_records/${RECORD_ID}" \
|
||||
-H "X-Auth-Email: ${EMAIL}" \
|
||||
-H "X-Auth-Key: ${API_KEY}" \
|
||||
-H "Content-Type: application/json" \
|
||||
--data '{"type":"A","name":"'${SUBDOMAIN}'","content":"'${ip}'","ttl":1,"proxied":false}'
|
||||
done < use/use.txt
|
Loading…
x
Reference in New Issue
Block a user