From bcec93200587add79687745b5557b6e4eeb3ba83 Mon Sep 17 00:00:00 2001 From: Myned Date: Sun, 17 Nov 2024 17:27:29 -0600 Subject: [PATCH] remote.sh: avoid suspending shutdown Signed-off-by: Myned --- options/custom/scripts/remote.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/options/custom/scripts/remote.sh b/options/custom/scripts/remote.sh index 5ae2131..b6202ae 100644 --- a/options/custom/scripts/remote.sh +++ b/options/custom/scripts/remote.sh @@ -68,6 +68,11 @@ fi # Suspend VM after connection ends if [[ "${argc_vm:-}" ]]; then - virsh suspend "${argc_host:-}" - notify-send "> remote" "${argc_host:-} paused" --urgency low + # Delay to avoid suspending shutdown + sleep 5 + + if [[ "$(virsh domstate "${argc_host:-}")" != "shut off" ]]; then + virsh suspend "${argc_host:-}" + notify-send "> remote" "${argc_host:-} paused" --urgency low + fi fi