From 263a168f99833b621638896a28bfe4ddbf29b329 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Fri, 20 Oct 2017 00:30:24 +0000 Subject: [PATCH] [sensors]: Workaround for apparent bug in lm-sensors --- dockers/docker-platform-monitor/lm-sensors.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/dockers/docker-platform-monitor/lm-sensors.sh b/dockers/docker-platform-monitor/lm-sensors.sh index 61e90c09a8e3..2f4768a8cdda 100755 --- a/dockers/docker-platform-monitor/lm-sensors.sh +++ b/dockers/docker-platform-monitor/lm-sensors.sh @@ -3,7 +3,19 @@ # Based off /etc/init.d/lm-sensors # -/usr/bin/sensors -s > /dev/null 2>&1 + +# NOTE: lm-sensors v3.3.5 appears to have a bug. If `sensors -s` is called, it +# will first load /etc/sensors.conf, then load all files in /etc/sensors.d/, +# overriding any values that may have already been specified in +# /etc/sensors.conf. However, it appears this overriding is not taking place. +# As a workaround, as long as a platform-specific sensors.conf has been copied +# to /etc/sensors.d/, we will ONLY load that file, otherwise we load the default. +if [ -e /etc/sensors.d/sensors.conf ]; then + /usr/bin/sensors -s -c /etc/sensors.d/sensors.conf > /dev/null 2>&1 +else + /usr/bin/sensors -s > /dev/null 2>&1 +fi + /usr/bin/sensors > /dev/null 2>&1 # Currently, there is no way to run sensord in the foreground, so we