XenServer: Alternate Auto-Start VM Option

Create the boot script

Method 1: Auto-start all servers

vi /etc/rc.d/init.d/RunVMonBoot.sh
#!/bin/bash
xe vm-list power-state=halted | grep uuid | cut -c 24- | xargs -I {Var} xe vm-start uuid={Var}

Method 2: Auto-start selected servers

vi /etc/rc.d/init.d/RunVMonBoot.sh
#!/bin/bash
xe vm-start uuid=SERVERUUIDHERE 

Note: Repeat “xe vm-start uuid=” line as many times as needed.

Press Escape followed by K to stop editing.

Press : followed by wq! to save changes and quit editing.

Run the following command to add execute privileges to the script.

chmod +x /etc/init.d/RunVMonBoot.sh

Run to add execute privileges to the startup script.
chmod +x /etc/rc.d/rc.local

Run the following to edit the startup script.
vi /etc/rc.d/rc.local

Append these lines to the script. (Press I to allow inserting.)

Sleep 180
/etc/rc.d/init.d/RunVMonBoot.sh

Press Escape followed by K to stop editing.

Press : followed by wq! to save changes and quit editing.

You may also like

Leave a Reply

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