Update cf-v4-ddns.sh

Bug fixed
This commit is contained in:
yulewang 2018-10-10 13:15:48 +08:00 committed by GitHub
parent 774878f6a1
commit 8b5fd9ea4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -120,7 +120,7 @@ RESPONSE=$(curl -s -X PUT "https://api.cloudflare.com/client/v4/zones/$CFZONE_ID
-H "X-Auth-Email: $CFUSER" \ -H "X-Auth-Email: $CFUSER" \
-H "X-Auth-Key: $CFKEY" \ -H "X-Auth-Key: $CFKEY" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
--data "{\"id\":\"$CFZONE_ID\",\"type\":\"A\",\"name\":\"$CFRECORD_NAME\",\"content\":\"$WAN_IP\", \"ttl\":\"$CFTTL\"}") --data "{\"id\":\"$CFZONE_ID\",\"type\":\"A\",\"name\":\"$CFRECORD_NAME\",\"content\":\"$WAN_IP\", \"ttl\":$CFTTL}")
if [ "$RESPONSE" != "${RESPONSE%success*}" ] && [ $(echo $RESPONSE | grep "\"success\":true") != "" ]; then if [ "$RESPONSE" != "${RESPONSE%success*}" ] && [ $(echo $RESPONSE | grep "\"success\":true") != "" ]; then
echo "Updated succesfuly!" echo "Updated succesfuly!"
@ -130,4 +130,4 @@ else
echo 'Something went wrong :(' echo 'Something went wrong :('
echo "Response: $RESPONSE" echo "Response: $RESPONSE"
exit 1 exit 1
fi fi