From 09025f1335b72e4b280ebdaf4e88df90fdf1631a Mon Sep 17 00:00:00 2001 From: Longxiang Lyu Date: Tue, 19 Sep 2023 06:38:28 +0000 Subject: [PATCH] [snmp] Check intfmgrd running before start Add pre start check to ensure intfmgrd is running. The check will run for 20 seconds at most. Signed-off-by: Longxiang Lyu --- files/build_templates/snmp.service.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/files/build_templates/snmp.service.j2 b/files/build_templates/snmp.service.j2 index c6e92ef59813..503d54eed3fd 100644 --- a/files/build_templates/snmp.service.j2 +++ b/files/build_templates/snmp.service.j2 @@ -10,6 +10,7 @@ StartLimitIntervalSec=1200 StartLimitBurst=3 [Service] +ExecStartPre=/bin/bash -c 'end=$((SECONDS+20));while [ $SECONDS -lt $end ];do if /usr/bin/pgrep intfmgrd >/dev/null;then break;else sleep 1;fi;done' ExecStartPre=/usr/local/bin/{{docker_container_name}}.sh start ExecStart=/usr/local/bin/{{docker_container_name}}.sh wait ExecStop=/usr/local/bin/{{docker_container_name}}.sh stop