From aea2e19ad4761a03978ad59fceb5bd18dc2b60a5 Mon Sep 17 00:00:00 2001 From: mssonicbld <79238446+mssonicbld@users.noreply.github.com> Date: Sat, 14 Oct 2023 08:16:00 +0800 Subject: [PATCH] [snmp] Check intfmgrd running before start (#16588) (#16881) Add pre start check to ensure intfmgrd is running. The check will run for 20 seconds at most. Signed-off-by: Longxiang Lyu Co-authored-by: Longxiang Lyu <35479537+lolyu@users.noreply.github.com> --- 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 5c753dd651..9d3224b805 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