e12d2e8bee
Extend the PMON daemon start control to lm-sensors and fancontrol. change template docker-pmon.supervisord.conf.j2 and start.sh.j2 to have lm-sensors and fancontrol start scripts and supervisord config file controlled by pmon_daemon_control.json. the intention is to avoid wrong daemon status in "supervisorctl status" output. For example, on some platform, if there is no fancontrol config file, and it is not ruled out from supervisord conf file and start.sh, we'll see fancontrol in "STOPPED" status from "supervisorctl status" output, which will violate some check in the platform test(check daemon status as expected)
78 lines
2.1 KiB
Django/Jinja
78 lines
2.1 KiB
Django/Jinja
#!/usr/bin/env bash
|
|
|
|
declare -r EXIT_SUCCESS="0"
|
|
|
|
mkdir -p /var/sonic
|
|
echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status
|
|
|
|
rm -f /var/run/rsyslogd.pid
|
|
|
|
supervisorctl start rsyslogd
|
|
|
|
# If this platform has synchronization script, run it
|
|
if [ -e /usr/share/sonic/platform/platform_wait ]; then
|
|
/usr/share/sonic/platform/platform_wait
|
|
EXIT_CODE="$?"
|
|
if [ "${EXIT_CODE}" != "${EXIT_SUCCESS}" ]; then
|
|
supervisorctl shutdown
|
|
exit "${EXIT_CODE}"
|
|
fi
|
|
fi
|
|
|
|
{% if not skip_sensors %}
|
|
# If this platform has an lm-sensors config file, copy it to it's proper place
|
|
# and start lm-sensors
|
|
if [ -e /usr/share/sonic/platform/sensors.conf ]; then
|
|
mkdir -p /etc/sensors.d
|
|
/bin/cp -f /usr/share/sonic/platform/sensors.conf /etc/sensors.d/
|
|
supervisorctl start lm-sensors
|
|
fi
|
|
{% endif %}
|
|
|
|
{% if not skip_fancontrol %}
|
|
# If this platform has a fancontrol config file, copy it to it's proper place
|
|
# and start fancontrol
|
|
if [ -e /usr/share/sonic/platform/fancontrol ]; then
|
|
# Remove stale pid file if it exists
|
|
rm -f /var/run/fancontrol.pid
|
|
|
|
/bin/cp -f /usr/share/sonic/platform/fancontrol /etc/
|
|
supervisorctl start fancontrol
|
|
fi
|
|
{% endif %}
|
|
|
|
|
|
# If the sonic-platform package is not installed, try to install it
|
|
pip show sonic-platform > /dev/null 2>&1
|
|
if [ $? -ne 0 ]; then
|
|
SONIC_PLATFORM_WHEEL="/usr/share/sonic/platform/sonic_platform-1.0-py2-none-any.whl"
|
|
echo "sonic-platform package not installed, attempting to install..."
|
|
if [ -e ${SONIC_PLATFORM_WHEEL} ]; then
|
|
pip install ${SONIC_PLATFORM_WHEEL}
|
|
if [ $? -eq 0 ]; then
|
|
echo "Successfully installed ${SONIC_PLATFORM_WHEEL}"
|
|
else
|
|
echo "Error: Failed to install ${SONIC_PLATFORM_WHEEL}"
|
|
fi
|
|
else
|
|
echo "Error: Unable to locate ${SONIC_PLATFORM_WHEEL}"
|
|
fi
|
|
fi
|
|
|
|
{% if not skip_ledd %}
|
|
supervisorctl start ledd
|
|
{% endif %}
|
|
|
|
{% if not skip_xcvrd %}
|
|
supervisorctl start xcvrd
|
|
{% endif %}
|
|
|
|
{% if not skip_psud %}
|
|
supervisorctl start psud
|
|
{% endif %}
|
|
|
|
{% if not skip_syseepromd %}
|
|
supervisorctl start syseepromd
|
|
{% endif %}
|
|
|