cf动态域名脚本

code · 2023-11-01

!/bin/bash

API_KEY="====="
ZONE_ID="====="
RECORD_ID="====="
DOMAIN="====="

IP=$(curl -s https://api.ipify.org)
echo "IP: $IP"

curl --request PUT \
--url https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records/$RECORD_ID \
-H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" \
--data ' {"content": "'$IP'","name": "'$DOMAIN'","proxied": false,"type": "A","ttl": 60}'

Theme Jasmine by Kent Liao