Commit e42d3401 authored by Yuanle Song's avatar Yuanle Song
Browse files

bugfix: require_update() should return false when new IP is 0.0.0.0

this fix should remove this email report by cron:

Error: bad IP address: 0.0.0.0.
parent 0e5d8922
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -125,8 +125,13 @@ get_myip() {
	fi
}

# returns true if domain is outdated. returns false otherwise.
# returns true if DNS record is outdated. returns false otherwise.
require_update() {
	if [ "$MYIP" = "0.0.0.0" ]; then
		# IP address unavailable. do not require update.
		return 1
	fi

	if [ ! -f "$LAST_IP_FILE" ]; then
		OLDIP=`dig +short $HOSTNAME`
		# dig always return 0. if no A record is found, OLDIP will be