qm status <VMID>
to check if the VM is running, if it is not it could be started with qm start <VMID>
.#!/bin/bash
VMIDLIST=(100 101 102 103) # list of VMIDs that should always be running
for vmid in ${VMIDLIST[*]}
do
if [ $(qm status $vmid) == "status: stopped" ]; then
qm start $vmid
fi
done