How to Set Auto Shutdown in Proxmox with 4 Simple Methods?

Auto shutdown helps Proxmox users save power and protect data when servers are idle or during outages. This guide shows you four simple ways to set it up step by step.

download-icon
Free Download
for VM, OS, DB, File, NAS, etc.
dan-zeng

Updated by Dan Zeng on 2025/06/18

Table of contents
  • What is Proxmox auto shutdown?

  • Method1. Use Cron for scheduled shutdown

  • Method2. Cron + script for idle detection

  • Method3. systemd timer + script

  • Method4. UPS + NUT integration

  • Protecting VMs after auto shutdown with Vinchin

  • Proxmox auto shutdown FAQs

  • Conclusion

Enabling auto shutdown in Proxmox allows you to power off the host or its VMs and containers automatically without manual input. You can trigger it by schedule, idle status, or UPS events. This saves energy, protects data, and reduces human error.

What is Proxmox auto shutdown?

Proxmox auto shutdown lets you execute shutdown tasks automatically. You can manage it using cron, systemd, or UPS tools. It's not just a basic Linux shutdown—Proxmox uses qm and pct to gracefully shut down VMs and containers. With qemu-guest-agent installed, Proxmox can even notify the guest OS for clean shutdowns.

If your server sits idle at night or you want to shut it down after backup, auto shutdown is ideal. It reduces power usage, defines clear maintenance windows, and avoids mistakes. 

Method1. Use Cron for scheduled shutdown

Cron is the simplest method. It doesn't check running tasks, but it's easy to use and reliable.

For example, shutdown every day at 1:00 AM:

0 1 * * * root /usr/sbin/shutdown -h now

Test first:

shutdown -h +5 "Test: shutdown in 5 minutes"
grep shutdown /var/log/syslog

VMs receive the ACPI signal and attempt graceful shutdown (if supported). But Cron won't check for ongoing tasks—so active jobs may be interrupted.

Method2. Cron + script for idle detection

A script can check for activity before shutdown, reducing risk of cutting off running VMs or jobs.

Sample script /root/shut.sh:

#!/bin/bash

ACTIVE_VMS=$(qm list | grep -cv stopped)
ACTIVE_PCT=$(pct list | grep -cv stopped)
ACTIVE_TASKS=$(pgrep -f "pvesr|zfs scrub|vzdump")

if [[ $ACTIVE_VMS -eq 0 && $ACTIVE_PCT -eq 0 && -z "$ACTIVE_TASKS" ]]; then
  echo "$(date): System idle. Preparing to shut down." >> /var/log/auto-shut.log
  shutdown -h +30 "Idle state: system will shut down in 30 minutes"
fi

Make it executable and add to Cron:

chmod +x /root/shut.sh
*/5 * * * * root /root/shut.sh

This checks every 5 minutes. If nothing is running, it schedules shutdown with a 30-minute delay.

Method3. systemd timer + script

For more control and better logs, use systemd in production.

Script: /usr/local/bin/autoshutdown

#!/bin/bash

ACTIVE_VMS=$(qm list | grep -cv stopped)
ACTIVE_PCT=$(pct list | grep -cv stopped)
ACTIVE_TASKS=$(pgrep -f "pvesr|zfs scrub|vzdump")

if [[ $ACTIVE_VMS -eq 0 && $ACTIVE_PCT -eq 0 && -z "$ACTIVE_TASKS" ]]; then
  echo "$(date): Confirmed idle. Shutting down soon." >> /var/log/autoshutdown.log
  shutdown -h +10 "Idle state: shutting down in 10 minutes"
fi

Systemd service /etc/systemd/system/autoshutdown.service:

[Unit]
Description=Proxmox Auto Shutdown Service

[Service]
Type=oneshot
ExecStartPre=/bin/sleep 300
ExecStart=/usr/local/bin/autoshutdown

Systemd timer /etc/systemd/system/autoshutdown.timer:

[Unit]
Description=Proxmox Auto Shutdown Timer

[Timer]
OnCalendar=*-*-* 23:00:00
Persistent=true

[Install]
WantedBy=timers.target

Enable it:

systemctl daemon-reload
systemctl enable --now autoshutdown.timer

Note: Type=oneshot prevents concurrent runs. The sleep 300 adds a 5-minute buffer.

Method4. UPS + NUT integration

Power failure protection is a must for business environments. NUT and UPS help shut down your system smartly.

Install NUT:

apt install nut

Configure /etc/nut/nut.conf:

MODE=netserver

Then edit /etc/nut/ups.conf and /etc/nut/upsmon.conf, e.g.:

MONITOR ups@localhost 1 monuser password slave
SHUTDOWNCMD "systemctl poweroff"

Monitor UPS:

upsc ups@localhost

Simulate power loss:

upsmon -c fsd

Shut down VMs before host:

qm shutdown <ID> --timeout 60
pct shutdown <ID> --timeout 60

Make sure qemu-guest-agent is installed on VMs to ensure they respond.

Protecting VMs after auto shutdown with Vinchin

Once auto shutdown is working, the next step is making sure your VM data stays safe.

To protect your Proxmox environment with confidence, consider Vinchin Backup & Recovery—a professional, enterprise-grade VM backup solution supporting Proxmox VE and 15+ platforms like VMware, Hyper-V, oVirt, RHV, XCP-ng, XenServer, and OpenStack.

Vinchin offers powerful features like forever-incremental backup, built-in deduplication and compression, V2V migration, and fast recovery options. These help reduce backup size, accelerate tasks, and simplify disaster recovery.

The user-friendly web console lets you back up a Proxmox VM in just four steps:

1.Just select VMs on the host

backup proxmox vm

2.Then select backup destination 

backup proxmox vm

3.Select strategies

backup proxmox vm

4.Finally submit the job

backup proxmox vm

Vinchin is trusted by global users and known for reliability. Start today with a 60-day full-featured free trial—click below to download and deploy in minutes.

Proxmox auto shutdown FAQs

Q1: How do I troubleshoot the timer or script?

Check systemctl status and journalctl -u autoshutdown.service.

Q2: What if shutdown hangs?
Use journalctl to inspect which service stalled.

Q3: Can I control the shutdown order for VMs?
Yes—shut down VMs by priority using qm shutdown in sequence.

Conclusion

Proxmox auto shutdown helps save power, protect data, and reduce risk. You can trigger it by schedule, idle check, or UPS. Choose the right method for your case and keep your system smart, safe, and efficient.


Share on:

Categories: VM Tips