Idle Proxmox Auto-Shutdown
1. Create the Script
nano /root/shutdown.sh#!/bin/bash
# Check all VMs for running status
VM_RUNNING=$(qm list | grep -c 'running')
# Check all containers for running status
CT_RUNNING=$(pct list | awk '$3 == "running" {print $1}' | wc -l)
# If neither VMs nor containers are running, power off
if [[ "$VM_RUNNING" -eq 0 && "$CT_RUNNING" -eq 0 ]]; then
poweroff
fichmod +x /root/shutdown.sh2. Add Cron Job
3. Verify & Test
PreviousRemotely Unlocking LUKS-Encrypted Proxmox with Dropbear SSH at BootNextSecure Remote Access with TailScale + Hardened SSH
Last updated