Proxmox VM auto start VM after found in shutdown state

I was having this strange issue, where a running busy VM stopeed all of a sudden due to high CPU or Memory overload issue. So manually had to start everythime. In order to avoid this, created a small script to start the VM in case if it’s down.

#!/bin/bash

# Set environment
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

su -

if [[ $(qm status 101) = *"status: stopped"* ]];
then
echo `qm start 101`
fi
Share

4 thoughts on “Proxmox VM auto start VM after found in shutdown state

    • You can put the script anywhere with the executable permission. What I did later to add it on the cron to check the status in every 5 mins.

  1. To launch automatically you must add with the crontab -e : * * * * * bash [the name of the directory where your script is]
    example bash /usr/local/sbin/[name of the script]

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.