From 8598ccaf8435628ebb98b36a27a8ee9f722a1b9c Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Thu, 15 Nov 2018 15:47:33 -0800 Subject: [PATCH] [syncd] extend syncd service script to support both warm/cold shutdown (#2238) - 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 | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/files/scripts/syncd.sh b/files/scripts/syncd.sh index 6dcbf01759..2d095d45aa 100755 --- a/files/scripts/syncd.sh +++ b/files/scripts/syncd.sh @@ -96,18 +96,22 @@ 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 - - # 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 warm shutdown syncd process ..." + TYPE=warm + else + TYPE=cold fi + debug "${TYPE} shutdown syncd process ..." + /usr/bin/docker exec -i syncd /usr/bin/syncd_request_shutdown --${TYPE} + + # 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..."