#!/bin/bash
# Stop all running VMs

PROXMOX_PASS="L@kers2010"
SITE1="192.168.11.10"
SITE2="192.168.11.11"

echo "Stopping all VMs on Site 1..."
sshpass -p "${PROXMOX_PASS}" ssh -o StrictHostKeyChecking=no root@${SITE1} "for vmid in \$(qm list | tail -n +2 | awk '{print \$1}'); do qm stop \$vmid 2>/dev/null || true; done"

echo "Stopping all VMs on Site 2..."
sshpass -p "${PROXMOX_PASS}" ssh -o StrictHostKeyChecking=no root@${SITE2} "for vmid in \$(qm list | tail -n +2 | awk '{print \$1}'); do qm stop \$vmid 2>/dev/null || true; done"

echo "Waiting for VMs to stop..."
sleep 10

echo "Done"

