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 allvmshutdown.sh with 755 permissions and add the list of VMs as in the example script:

#!/bin/bash
xe vm-shutdown vm=VM1
xe vm-shutdown vm=
VM2
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/allvmshutdown.sh

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.