Skip to content

Commit

Permalink
[syncd] extend syncd service script to support both warm/cold shutdown (
Browse files Browse the repository at this point in the history
#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 <ying.xie@microsoft.com>
  • Loading branch information
yxieca authored Nov 15, 2018
1 parent f126000 commit 8598cca
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions files/scripts/syncd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand Down

0 comments on commit 8598cca

Please sign in to comment.