diff --git a/src/power.sh b/src/power.sh index 18f87c1..0cdbc9b 100644 --- a/src/power.sh +++ b/src/power.sh @@ -4,7 +4,7 @@ set -Eeuo pipefail # Configure QEMU for graceful shutdown QEMU_PORT=7100 -QEMU_TIMEOUT=50 +QEMU_TIMEOUT=55 QEMU_PID="/run/qemu.pid" QEMU_COUNT="/run/qemu.count" @@ -67,6 +67,10 @@ _graceful_shutdown() { done + if [ "$(cat $QEMU_COUNT)" -ge "$QEMU_TIMEOUT" ]; then + echo && error "Shutdown timeout reached, forcefully quitting.." + fi + echo && echo "❯ Quitting..." echo 'quit' | nc -q 1 -w 1 localhost "$QEMU_PORT" >/dev/null 2>&1 || true