From 63ca30d62d8340fd3b61e7bc34cbb0a25a0e0e3d Mon Sep 17 00:00:00 2001 From: Kroese Date: Mon, 8 May 2023 19:30:25 +0200 Subject: [PATCH] Hide netcat output --- run/power.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/run/power.sh b/run/power.sh index 79563e9..004488b 100644 --- a/run/power.sh +++ b/run/power.sh @@ -47,9 +47,13 @@ _graceful_shutdown() { if ((AGENT_VERSION > 1)); then # Send a NMI interrupt which will be detected by the kernel - echo 'nmi' | nc -q 1 -w 1 localhost "${QEMU_MONPORT}" > /dev/null + if ! echo 'nmi' | nc -q 1 -w 1 localhost "${QEMU_MONPORT}" > /dev/null ; then + AGENT_VERSION=0 + fi - else + fi + + if ((AGENT_VERSION < 2)); then echo && echo "Please update the VirtualDSM Agent to allow for gracefull shutdowns..." @@ -65,7 +69,7 @@ _graceful_shutdown() { echo $(($(cat ${_QEMU_SHUTDOWN_COUNTER})+1)) > ${_QEMU_SHUTDOWN_COUNTER} # Try to connect to qemu - if echo 'info version'| nc -q 1 -w 1 localhost "${QEMU_MONPORT}" > /dev/null; then + if echo 'info version'| nc -q 1 -w 1 localhost "${QEMU_MONPORT}" >/dev/null 2>&1 ; then sleep 1 #echo "Shutting down, waiting... ($(cat ${_QEMU_SHUTDOWN_COUNTER})/${QEMU_POWERDOWN_TIMEOUT})" @@ -75,7 +79,7 @@ _graceful_shutdown() { done echo && echo "Quitting..." - echo 'quit' | nc -q 1 -w 1 localhost "${QEMU_MONPORT}" > /dev/null || true + echo 'quit' | nc -q 1 -w 1 localhost "${QEMU_MONPORT}" >/dev/null 2>&1 || true return }