restart api on multiple nodes
Posted: Fri Jul 31, 2026 8:04 pm
Notice seq 301 330, this would be vm 301-330.
This would restart api on all of them, one after another.
You write this in pve shell, and its the equivivalent of writing pm2 restart api in each individual evernode vm.
This would restart api on all of them, one after another.
You write this in pve shell, and its the equivivalent of writing pm2 restart api in each individual evernode vm.
Code: Select all
for vmid in $(seq 301 330); do
echo "=== VM $vmid ==="
if ! qm status "$vmid" 2>/dev/null | grep -q "status: running"; then
echo "Skipped: VM missing or stopped"
continue
fi
qm guest exec "$vmid" -- /bin/bash -lc \
"su - root -c 'pm2 restart api'"
done