From 9899e7aa98127dec247663234765812e8cb62c68 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 15 Jul 2022 19:01:29 +0100 Subject: [PATCH] Try different paths for vcgencmd --- check_rpi_temperature.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/check_rpi_temperature.sh b/check_rpi_temperature.sh index 895ffeb..9e49b7c 100755 --- a/check_rpi_temperature.sh +++ b/check_rpi_temperature.sh @@ -10,6 +10,17 @@ if [ $? -ne 0 ]; then exit -2 fi +pathToVcGenCmd=/usr/bin/vcgencmd +if [ ! -x "$pathToVcGenCmd" ]; then + pathToVcGenCmd=/opt/vc/bin/vcgencmd +fi +if [ ! -x "$pathToVcGenCmd" ]; then + pathToVcGenCmd=$(which vcgencmd 2> /dev/null) +fi +if [ ! -x "$pathToVcGenCmd" ]; then + echoerr Cannot find vcgencmd + exit -3 +fi WARN=50 CRIT=70 @@ -62,7 +73,7 @@ function log { NL=$'\n' -output=$(/opt/vc/bin/vcgencmd measure_temp) +output=$($pathToVcGenCmd measure_temp) result=$? log vcgencmd: $result. $output if [ $result -ne 0 ]; then