From 808066b5a3a4fbd86e78472a1347bba79aebd893 Mon Sep 17 00:00:00 2001 From: wzhy90 Date: Sun, 5 Mar 2017 18:09:44 +0800 Subject: [PATCH] Fixes update IP success or not. After echo some things, the return will allways be 0. --- ddnspod.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ddnspod.sh b/ddnspod.sh index cad008b..656a9a1 100755 --- a/ddnspod.sh +++ b/ddnspod.sh @@ -169,10 +169,11 @@ arDdnsUpdate() { # Output IP if [ "$recordCD" = "1" ]; then echo $recordRS | sed 's/.*,"value":"\([0-9\.]*\)".*/\1/' - return 1 + return 0 fi # Echo error message echo $recordRS | sed 's/.*,"message":"\([^"]*\)".*/\1/' + return 1 } # DDNS Check @@ -188,8 +189,8 @@ arDdnsCheck() { echo "lastIP: ${lastIP}" if [ "$lastIP" != "$hostIP" ]; then postRS=$(arDdnsUpdate $1 $2) - echo "postRS: ${postRS}" - if [ $? -ne 1 ]; then + if [ $? -eq 0 ]; then + echo "postRS: ${postRS}" return 0 fi fi