Skip to content

Commit

Permalink
Fixes update IP success or not.
Browse files Browse the repository at this point in the history
After echo some things, the return will allways be 0.
  • Loading branch information
wzhy90 committed Mar 5, 2017
1 parent 9bff199 commit 808066b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ddnspod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 808066b

Please sign in to comment.