From 555b8eb7b6d13277508dde4bb85a457e73d48b90 Mon Sep 17 00:00:00 2001 From: Alexis Ben Miloud--Josselin Date: Thu, 19 Jul 2018 11:37:29 +0200 Subject: [PATCH] Fix crash when vm is not running Due to the `set -e`, the script exited when $VM was no in "running" state. --- kvmstats.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kvmstats.sh b/kvmstats.sh index d465b8c..79399a0 100644 --- a/kvmstats.sh +++ b/kvmstats.sh @@ -72,7 +72,7 @@ do DISK=0 esac done - RUNNING=$(virsh domstate "$VM" | grep -q '^running$' && echo X) + RUNNING=$(virsh domstate "$VM" | grep -q '^running$' && echo yes || echo no) echo "$VM $VCPU $RAM $DISK $RUNNING" done >"$TMPFILE"