Skip to content

Commit 18e959a

Browse files
yozhao101zhenggen-xu
authored andcommitted
[Services] Restart LLDP service upon unexpected critical process exit. (sonic-net#3713)
Signed-off-by: Yong Zhao <[email protected]>
1 parent 3457c7a commit 18e959a

File tree

5 files changed

+16
-0
lines changed

5 files changed

+16
-0
lines changed

dockers/docker-lldp-sv2/Dockerfile.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,7 @@ COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
4040
COPY ["lldpd.conf.j2", "/usr/share/sonic/templates/"]
4141
COPY ["lldpd", "/etc/default/"]
4242
COPY ["lldpmgrd", "/usr/bin/"]
43+
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
44+
COPY ["critical_processes", "/etc/supervisor"]
4345

4446
ENTRYPOINT ["/usr/bin/supervisord"]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
lldpd
2+
lldp-syncd
3+
lldpmgrd

dockers/docker-lldp-sv2/supervisord.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ logfile_maxbytes=1MB
33
logfile_backups=2
44
nodaemon=true
55

6+
[eventlistener:supervisor-proc-exit-listener]
7+
command=/usr/bin/supervisor-proc-exit-listener
8+
events=PROCESS_STATE_EXITED
9+
autostart=true
10+
autorestart=unexpected
11+
612
[program:start.sh]
713
command=/usr/bin/start.sh
814
priority=1

files/build_templates/lldp.service.j2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@ Description=LLDP container
33
Requires=updategraph.service
44
After=updategraph.service swss.service syncd.service
55
Before=ntp-config.service
6+
StartLimitIntervalSec=1200
7+
StartLimitBurst=3
68

79
[Service]
810
User={{ sonicadmin_user }}
911
ExecStartPre=/usr/bin/{{docker_container_name}}.sh start
1012
ExecStart=/usr/bin/{{docker_container_name}}.sh wait
1113
ExecStop=/usr/bin/{{docker_container_name}}.sh stop
14+
Restart=always
15+
RestartSec=30
1216

1317
[Install]
1418
WantedBy=multi-user.target

rules/docker-lldp-sv2.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ $(DOCKER_LLDP_SV2)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
3030

3131
$(DOCKER_LLDP_SV2)_BASE_IMAGE_FILES += lldpctl:/usr/bin/lldpctl
3232
$(DOCKER_LLDP_SV2)_BASE_IMAGE_FILES += lldpcli:/usr/bin/lldpcli
33+
$(DOCKER_LLDP_SV2)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)

0 commit comments

Comments
 (0)