From 95f4fa176f273d540b32f1c5646a670cde66e4be Mon Sep 17 00:00:00 2001 From: Vasil Ivanov Date: Thu, 18 May 2023 14:16:09 +0300 Subject: [PATCH 1/2] Fix shell arithmetic in sdv-health --- src/sh/sdv-health | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sh/sdv-health b/src/sh/sdv-health index 977e3fb..c451206 100755 --- a/src/sh/sdv-health +++ b/src/sh/sdv-health @@ -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 @@ -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 )" From ab252e78988bc226c561e271a8ef871b36a3bdf4 Mon Sep 17 00:00:00 2001 From: Vasil Ivanov Date: Thu, 18 May 2023 14:21:34 +0300 Subject: [PATCH 2/2] Fix linter erorr --- src/sh/sdv-health | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sh/sdv-health b/src/sh/sdv-health index c451206..ae5a840 100755 --- a/src/sh/sdv-health +++ b/src/sh/sdv-health @@ -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