From bbd5440cb6d888fa0ee0827da9c75a0d7ea401f4 Mon Sep 17 00:00:00 2001 From: Longxiang Lyu <35479537+lolyu@users.noreply.github.com> Date: Sat, 14 Oct 2023 07:00:51 +0800 Subject: [PATCH] [snmp] Check intfmgrd running before start (#16588) 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 5c753dd651eb..9d3224b805b7 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