Hide netcat output

This commit is contained in:
Kroese 2023-05-08 19:30:25 +02:00 committed by GitHub
parent 142b27f529
commit 63ca30d62d

View File

@ -47,9 +47,13 @@ _graceful_shutdown() {
if ((AGENT_VERSION > 1)); then if ((AGENT_VERSION > 1)); then
# Send a NMI interrupt which will be detected by the kernel # 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..." 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} echo $(($(cat ${_QEMU_SHUTDOWN_COUNTER})+1)) > ${_QEMU_SHUTDOWN_COUNTER}
# Try to connect to qemu # 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 sleep 1
#echo "Shutting down, waiting... ($(cat ${_QEMU_SHUTDOWN_COUNTER})/${QEMU_POWERDOWN_TIMEOUT})" #echo "Shutting down, waiting... ($(cat ${_QEMU_SHUTDOWN_COUNTER})/${QEMU_POWERDOWN_TIMEOUT})"
@ -75,7 +79,7 @@ _graceful_shutdown() {
done done
echo && echo "Quitting..." 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 return
} }