Skip to content

Commit

Permalink
Fix shell arithmetic for the cloudconnector check in sdv-health (#41)
Browse files Browse the repository at this point in the history
* Fix shell arithmetic in sdv-health
* Fix linter erorr
  • Loading branch information
vasilvas99 committed May 18, 2023
1 parent cf1dd37 commit 6680424
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sh/sdv-health
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ check_cloudconnector()
local SINCE
LAST_UPDATE=$(mosquitto_sub --quiet -h ${MOSQUITTO_HOST} -t 'edge/connection/remote/status' -C 1 -W 1 | jq .timestamp)
NOW=$(date +"%s")
DIFF=$($NOW - $LAST_UPDATE)
DIFF=$((NOW - LAST_UPDATE))
SINCE=$(date -u -d @"$DIFF" +'%-Mm %-Ss')
printf -- "$TEXT_OK\t (connected since $SINCE)\n"
else
Expand Down Expand Up @@ -452,7 +452,7 @@ else
fi

# Static ip for mosquitto server. Containers will have access to host networks iff they run in host network mode.
MOSQUITTO_HOST="127.0.0.1:1883"
MOSQUITTO_HOST="127.0.0.1"

printf -- " * %-23s : %s\n" "Cloud Connector" "$( check_cloudconnector )"
printf -- " * %-23s : ${COL_YELLOW}%s${COL_NC}\n" "Device ID:" "$( check_cloudconnector_deviceid )"
Expand Down

0 comments on commit 6680424

Please sign in to comment.