fix: Shutdown loop (#474)

This commit is contained in:
Kroese 2023-12-20 12:09:25 +01:00 committed by GitHub
parent fd19c7b4f3
commit ef5b650991
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,20 +53,16 @@ _graceful_shutdown() {
while [ "$(cat $QEMU_COUNT)" -lt "$QEMU_TIMEOUT" ]; do
# Try to connect to qemu
if echo 'info version'| nc -q 1 -w 1 localhost "$QEMU_PORT" >/dev/null 2>&1 ; then
sleep 1
# Increase the counter
cnt=$(($(cat $QEMU_COUNT)+1))
echo $cnt > "$QEMU_COUNT"
[[ "$DEBUG" == [Yy1]* ]] && info "Shutting down, waiting... ($cnt/$QEMU_TIMEOUT)"
else
break
if ! echo 'info version'| nc -q 1 -w 1 localhost "$QEMU_PORT" >/dev/null 2>&1 ; then
break
fi
# Increase the counter
cnt=$(($(cat $QEMU_COUNT)+1))
echo $cnt > "$QEMU_COUNT"
[[ "$DEBUG" == [Yy1]* ]] && info "Shutting down, waiting... ($cnt/$QEMU_TIMEOUT)"
done
if [ "$(cat $QEMU_COUNT)" -ge "$QEMU_TIMEOUT" ]; then