[Services] Restart Platform-monitor service upon unexpected critical process exit. (#3689)

Signed-off-by: Yong Zhao <yozhao@microsoft.com>
This commit is contained in:
yozhao101 2019-11-04 17:44:01 -08:00 committed by Joe LeVeque
parent d85777bb11
commit 4fa3a1e27e
5 changed files with 18 additions and 0 deletions

View File

@ -57,5 +57,7 @@ RUN apt-get purge -y \
COPY ["docker_init.sh", "lm-sensors.sh", "/usr/bin/"] COPY ["docker_init.sh", "lm-sensors.sh", "/usr/bin/"]
COPY ["docker-pmon.supervisord.conf.j2", "start.sh.j2", "/usr/share/sonic/templates/"] COPY ["docker-pmon.supervisord.conf.j2", "start.sh.j2", "/usr/share/sonic/templates/"]
COPY ["ssd_tools/*", "/usr/bin/"] COPY ["ssd_tools/*", "/usr/bin/"]
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
COPY ["critical_processes", "/etc/supervisor"]
ENTRYPOINT ["/usr/bin/docker_init.sh"] ENTRYPOINT ["/usr/bin/docker_init.sh"]

View File

@ -0,0 +1,5 @@
fancontrol
ledd
xcvrd
psud
syseepromd

View File

@ -3,6 +3,12 @@ logfile_maxbytes=1MB
logfile_backups=2 logfile_backups=2
nodaemon=true nodaemon=true
[eventlistener:supervisor-proc-exit-listener]
command=/usr/bin/supervisor-proc-exit-listener
events=PROCESS_STATE_EXITED
autostart=true
autorestart=unexpected
[program:start.sh] [program:start.sh]
command=/usr/bin/start.sh command=/usr/bin/start.sh
priority=1 priority=1

View File

@ -6,12 +6,16 @@ After=updategraph.service
After=syncd.service After=syncd.service
{% endif %} {% endif %}
Before=ntp-config.service Before=ntp-config.service
StartLimitIntervalSec=1200
StartLimitBurst=3
[Service] [Service]
User={{ sonicadmin_user }} User={{ sonicadmin_user }}
ExecStartPre=/usr/bin/{{docker_container_name}}.sh start ExecStartPre=/usr/bin/{{docker_container_name}}.sh start
ExecStart=/usr/bin/{{docker_container_name}}.sh wait ExecStart=/usr/bin/{{docker_container_name}}.sh wait
ExecStop=/usr/bin/{{docker_container_name}}.sh stop ExecStop=/usr/bin/{{docker_container_name}}.sh stop
Restart=always
RestartSec=30
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View File

@ -44,3 +44,4 @@ $(DOCKER_PLATFORM_MONITOR)_BASE_IMAGE_FILES += cmd_wrapper:/usr/bin/sensors
$(DOCKER_PLATFORM_MONITOR)_BASE_IMAGE_FILES += cmd_wrapper:/usr/sbin/smartctl $(DOCKER_PLATFORM_MONITOR)_BASE_IMAGE_FILES += cmd_wrapper:/usr/sbin/smartctl
$(DOCKER_PLATFORM_MONITOR)_BASE_IMAGE_FILES += cmd_wrapper:/usr/sbin/iSmart $(DOCKER_PLATFORM_MONITOR)_BASE_IMAGE_FILES += cmd_wrapper:/usr/sbin/iSmart
$(DOCKER_PLATFORM_MONITOR)_BASE_IMAGE_FILES += cmd_wrapper:/usr/sbin/SmartCmd $(DOCKER_PLATFORM_MONITOR)_BASE_IMAGE_FILES += cmd_wrapper:/usr/sbin/SmartCmd
$(DOCKER_PLATFORM_MONITOR)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)