Joshua Avalon 8 anos atrás
pai
commit
379e98baeb
1 arquivos alterados com 9 adições e 9 exclusões
  1. 9 9
      cloudflare.sh

+ 9 - 9
cloudflare.sh

@@ -6,11 +6,11 @@ ip_file="ip"
 new_ip=$(curl -s http://ipecho.net/plain)
 
 if [ -f $ip_file ]; then
-    ip=$(cat $ip_file)
-    if [ "$ip" = "$new_ip" ]; then
-		echo "Same ip: $ip"
-        exit 0
-    fi
+  ip=$(cat $ip_file)
+  if [ "$ip" = "$new_ip" ]; then
+    echo "Same ip: $ip"
+    exit 0
+  fi
 fi
 
 ip="$new_ip"
@@ -22,9 +22,9 @@ echo "Record ID: $record_id"
 update=$(curl -s -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" -H "Content-Type: application/json" --data "{\"id\":\"$zone_id\",\"type\":\"A\",\"name\":\"$HOST\",\"content\":\"$ip\",\"ttl\":$TTL,\"proxied\":$PROXY}")
 
 if echo "$update" | grep -q "\"success\":true"; then
-	echo "IP changed to: $ip"	
+    echo "IP changed to: $ip"	
   echo "$ip" > $ip_file
 else
-	printf "Update failed:\\n%s" "$update"
-	exit 1
-fi
+  printf "Update failed:\\n%s" "$update"
+  exit 1
+fi