Auto shutdown script for Xen VMs on XenServer

1 Comment(s)

In case of a scheduled maintenance which requires your Xen VMs to be shutdown on your Xen server when you are not available, the following script should can be put to use:

Create a script as with 755 permissions and add the list of VMs as in the example script:

xe vm-shutdown vm=VM1
xe vm-shutdown vm=
xe vm-shutdown vm=VM3
xe vm-shutdown vm=VM4
xe vm-shutdown vm=VM5
xe vm-shutdown vm=VM6
xe vm-shutdown vm=VM7
xe vm-shutdown vm=VM8
xe vm-shutdown vm=VM9
xe vm-shutdown vm=VM10

To get a list of VMs on the server, run the command #xe vm-list from the command line, which will list the VMs hosted on your Xen host.

Now you just need to add a cron entry to schedule this job. For example, to run script at 02:00 am on Sunday:

crontab -e
*   02 *    *    0           /scripts/

Note: Do ensure that the script is commented or removed from the crontab, after the maintenance has been completed to prevent this script from recurring.


One response to “Auto shutdown script for Xen VMs on XenServer”

  1. I use a xenserver that hosts a webserver as well as 13 windows VMs. I need to come up with a way to reboot them about every 4 hours in a staggered fashion. Do you have any advice or can I hire you to help me with this?

Leave a Reply

Your email address will not be published. Required fields are marked *

2 + 8 =

Looking for any specific topic / article?

Generic selectors
Exact matches only
Search in title
Search in content

Most popular searches: Technology, Website, AI

Enjoy this blog?

Your may interested in our latest blogs

Stay Updated

Please enter your details below to get
A Free Trial
x + x* =