Shut down ESXi 5.1 guest VMs and the host (free edition) via SSH – the easy way!

Thanks go out to reader Everett for pointing out an easier way to gracefully shutdown guest VMs and the host on a VMware ESXi 5.1 (free) server.

This is much easier than the method described in the previous post I made on the subject, although that method may have been necessary at the time due to issues with VMware 5.0 U1, or still may be necessary in special cases (clustering, etc.).  The previous method also gives you a tiny bit more control, but it is not supported.

You may want to gracefully shut down your guest VMs and host ESXi 5.1 server via SSH, for example, on the triggering of a UPS power outage event or something similar.

The method is as follows:

1) Install VMware Tools in all guest VMs.

2) Make sure each guest VM is setup to perform the shutdown action “Guest Shutdown” (or you could also use a suspend, if you wanted to) in the virtual host settings “Virtual Machine Startup and Shutdown” section.

3) The following two commands, run in sequence, will shutdown the properly configured guest VMs and the host server also:

/sbin/shutdown.sh && /sbin/poweroff

These commands can be run in sequence via an SSH connection from another system (for example, a batch file and plink on Windows, on a machine running a UPS).  The poweroff will only run if the shutdown.sh script runs successfully.

4) That’s it!

Thanks Everett!

Advertisements
Posted in Vmware

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: