Skip to content

Commit 2600747

Browse files
authored
[docker-pmon] Fix copy of fancontrol config file (#5037)
Copy proper fancontrol config file to the proper destination. Also some minor refactoring for code reuse to help prevent issues like this in the future. Fixes a bug introduced by #4599
1 parent ddf9fdd commit 2600747

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

dockers/docker-platform-monitor/docker_init.sh

+10-9
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@
33
# Generate supervisord config file and the start.sh scripts
44
mkdir -p /etc/supervisor/conf.d/
55

6+
SENSORS_CONF_FILE="/usr/share/sonic/platform/sensors.conf"
7+
FANCONTROL_CONF_FILE="/usr/share/sonic/platform/fancontrol"
68

79
HAVE_SENSORS_CONF=0
810
HAVE_FANCONTROL_CONF=0
911

10-
if [ -e /usr/share/sonic/platform/sensors.conf ]; then
12+
if [ -e $SENSORS_CONF_FILE ]; then
1113
HAVE_SENSORS_CONF=1
1214
fi
1315

14-
if [ -e /usr/share/sonic/platform/fancontrol ]; then
16+
if [ -e $FANCONTROL_CONF_FILE ]; then
1517
HAVE_FANCONTROL_CONF=1
1618
fi
1719

@@ -24,19 +26,18 @@ else
2426
sonic-cfggen -a "$confvar" -t /usr/share/sonic/templates/docker-pmon.supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf
2527
fi
2628

27-
# If this platform has an lm-sensors config file, copy it to it's proper place.
28-
if [ -e /usr/share/sonic/platform/sensors.conf ]; then
29+
# If this platform has an lm-sensors config file, copy it to its proper place
30+
if [ $HAVE_SENSORS_CONF -eq 1 ]; then
2931
mkdir -p /etc/sensors.d
30-
/bin/cp -f /usr/share/sonic/platform/sensors.conf /etc/sensors.d/
32+
/bin/cp -f $SENSORS_CONF_FILE /etc/sensors.d/
3133
fi
3234

33-
# If this platform has a fancontrol config file, copy it to it's proper place
34-
# and start fancontrol
35-
if [ -e /usr/share/sonic/platform/fancontrol ]; then
35+
# If this platform has a fancontrol config file, copy it to its proper place
36+
if [ $HAVE_FANCONTROL_CONF -eq 1 ]; then
3637
# Remove stale pid file if it exists
3738
rm -f /var/run/fancontrol.pid
3839

39-
/bin/cp -f /usr/share/sonic/templates/fancontrol.conf /etc/supervisord/conf.d/
40+
/bin/cp -f $FANCONTROL_CONF_FILE /etc/
4041
fi
4142

4243
exec /usr/bin/supervisord

0 commit comments

Comments
 (0)