Skip to content

Commit 8598cca

Browse files
authored
[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 <[email protected]>
1 parent f126000 commit 8598cca

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

files/scripts/syncd.sh

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,21 @@ stop() {
9696
debug "Warm boot flag: ${SERVICE} ${WARM_BOOT}."
9797

9898
if [[ x"$WARM_BOOT" == x"true" ]]; then
99-
debug "Warm shutdown syncd process ..."
100-
/usr/bin/docker exec -i syncd /usr/bin/syncd_request_shutdown --warm
99+
TYPE=warm
100+
else
101+
TYPE=cold
102+
fi
101103

102-
# wait until syncd quits gracefully
103-
while docker top syncd | grep -q /usr/bin/syncd; do
104-
sleep 0.1
105-
done
104+
debug "${TYPE} shutdown syncd process ..."
105+
/usr/bin/docker exec -i syncd /usr/bin/syncd_request_shutdown --${TYPE}
106106

107-
/usr/bin/docker exec -i syncd /bin/sync
108-
debug "Finished warm shutdown syncd process ..."
109-
fi
107+
# wait until syncd quits gracefully
108+
while docker top syncd | grep -q /usr/bin/syncd; do
109+
sleep 0.1
110+
done
111+
112+
/usr/bin/docker exec -i syncd /bin/sync
113+
debug "Finished ${TYPE} shutdown syncd process ..."
110114

111115
/usr/bin/${SERVICE}.sh stop
112116
debug "Stopped ${SERVICE} service..."

0 commit comments

Comments
 (0)