Update monitor-all.sh to restart virtual machines instead of resetting

Resetting a virtual machine may not work if the virtual machine is frozen/stuck. (Home Assistant OS tends to get into this state sometimes and resetting it does nothing.)

Restarting the VM by stopping it and starting it seems to resolve the issue.
This commit is contained in:
Csaba Kos 2023-08-18 18:45:49 -05:00 committed by GitHub
parent cb4097e74c
commit d1a6332186
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -73,12 +73,13 @@ while true; do
else else
# It is a virtual machine # It is a virtual machine
if qm status $instance | grep -q "status: running"; then if qm status $instance | grep -q "status: running"; then
echo "$(date): VM $instance is not responding, resetting..." echo "$(date): VM $instance is not responding, restarting..."
qm reset $instance >/dev/null 2>&1 qm stop $instance >/dev/null 2>&1
sleep 5
else else
qm start $instance >/dev/null 2>&1
echo "$(date): VM $instance is not running, starting..." echo "$(date): VM $instance is not running, starting..."
fi fi
qm start $instance >/dev/null 2>&1
fi fi
fi fi
done done