From a62391ffa6125587d18dd86fb20f96dee6ec3de2 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 8 Nov 2018 01:14:41 +0000 Subject: [PATCH] [syncd] extend syncd service script to support both warm/cold shutdown - cold shutdown is used by regular service stop and/or fast reboot - warm shutdown is used by warm restart and/or warm reboot Signed-off-by: Ying Xie --- files/scripts/syncd.sh | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/files/scripts/syncd.sh b/files/scripts/syncd.sh index 08c50a2c37c5..2fb239928301 100755 --- a/files/scripts/syncd.sh +++ b/files/scripts/syncd.sh @@ -96,17 +96,21 @@ stop() { debug "Warm boot flag: ${SERVICE} ${WARM_BOOT}." if [[ x"$WARM_BOOT" == x"true" ]]; then - debug "Warm shutdown syncd process ..." - /usr/bin/docker exec -i syncd /usr/bin/syncd_request_shutdown --warm + TYPE=warm + else + TYPE=cold + fi - # wait until syncd quits gracefully - while docker top syncd | grep -q /usr/bin/syncd; do - sleep 0.1 - done + debug "${TYPE} shutdown syncd process ..." + /usr/bin/docker exec -i syncd /usr/bin/syncd_request_shutdown --${TYPE} - /usr/bin/docker exec -i syncd /bin/sync - debug "Finished warm shutdown syncd process ..." - fi + # wait until syncd quits gracefully + while docker top syncd | grep -q /usr/bin/syncd; do + sleep 0.1 + done + + /usr/bin/docker exec -i syncd /bin/sync + debug "Finished ${TYPE} shutdown syncd process ..." /usr/bin/${SERVICE}.sh stop debug "Stopped ${SERVICE} service..."