Created
July 10, 2015 11:15
-
-
Save Paulomart/721700fe09c889a39485 to your computer and use it in GitHub Desktop.
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
zone="example.com" | |
sub="subdomain" # subdomain | |
email="fuu@example.com" # your cloudflare email | |
token="xxxxxxxxxxxxxx" # you api key | |
rid="xxx" # record id, find it with https://www.cloudflare.com/docs/client-api.html#s3.3 3.3 - "rec_load_all" - Retrieve DNS Records of a given domain | |
IP=$(curl http://icanhazip.com/) | |
echo "Setting cloudflare dns $sub.$zone to $IP" | |
curl https://www.cloudflare.com/api_json.html -d 'a=rec_edit' -d "tkn=$token" -d "id=$rid" -d "email=$email" -d "z=$zone" -d 'type=A' -d "name=$sub" -d "content=$IP" -d 'service_mode=0' -d 'ttl=1' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment