Maci mini ESXi automatically start after detected power failure

I am currently setting up Mac mini 2012 as ESXi 5.5u2 host.

Mac minis are able to automatically start only after loss of power (http://www.virtuallyghetto.com/2013/02/enable-auto-startup-after-power-failure.html) or on schedule (every day at X:X PM). They can't automatically start when power is connected (after clean shudown -> power off).

I am dealing with this setup.

Our UPS are centrally managed by NUT (Network UPS Tools - Welcome). So when power goes out NUT server notifies all clients to shutdown. There is such client for ESXi (http://rene.margar.fr/2012/05/client-nut-pour-esxi-5-0/).

However If I want Mac mini to automatically start, it's power must be cut off.

In OS X there is halt -u command which does what I want.

-u      The system is halted up until the point of removing system power,

        but waits before removing power for 5 minutes so that an external

        UPS (uninterruptible power supply) can forcibly remove power.

        This simulates a dirty shutdown to permit a later automatic power

        on. OS X uses this mode automatically with supported UPSs in

        emergency shutdowns.

1) Halt OS

2) Wait for loss of power

3) When power is restored SMC automatically starts Mac mini

Is there a way to do the same in ESXi?

Desired scenario would look like this

1) NUT client on ESXi host gets notification of imininent power failure

2) Shudown all running VMs

3) HALT hypervisor

4) wait for powerloss

I found halt command in ESXi shell but it shutdowns Mac mini (complete power off).

Tags (3)
0 Kudos
3 Replies

I think this (short re-cycling power-off/power-on line to your Mac) is something you should configure in your UPS, whenever power is restored. Another option is to use "wake-up on lan" capability, but this must be supported by both nic and bios...

_____________________________________________ If you found my answer useful please do *not* mark it as "correct" or "helpful". It is hard to pretend being noob with all those points! 😉
0 Kudos

UPS is not directly connected to Mac. It is managed by NUT server.

Macs does only support wake-on LAN from sleep NOT from powered off state.

I suppose I could do this

1) NUT client gets notification saying power loss immintent

2) Shutdown ALL VMs

3) Let ESXi hypervisor die when power loss occurs

I am trying to find better way though 🙂 (halting system before power loss)

0 Kudos

After discussion here -> http://www.virtuallyghetto.com/2013/02/enable-auto-startup-after-power-failure.html

I have two solutions available.

A) shutdown.sh

  1. NUT client running on ESXi detects LB status from NUT server managing UPS.
  2. Instead of poweroff command, nut script runs /bin/shutdown.sh script. This requires editing original .vib package from here -> http://rene.margar.fr/2012/05/client-nut-pour-esxi-5-0/
  3. shudown.sh shutdown all running VMs (acording to set policy - automatically start and shutdown with host)
  4. shutdown.sh also stops a lot of hypervisor system services
  5. wait for powe rloss to occur
  6. Mac mini is automatically restarted when power comes back online thanks to SMC hw feature

I am not sure if ESXi  (after completion of shutdown.sh) is in state in which it can be allowed to die withou possible consequences

B) SMC schedule

  1. NUT client running on ESXi detects LB status from NUT server managing UPS.
  2. nut script executes ESXi poweroff command
  3. Mac mini poweroffs completely
  4. Mac mini is automatically powered on schedule set in SMC (http://www.dssw.co.uk/blog/2010-11-02-how-to-power-on-your-mac-at-a-specific-date-and-time/)

Automatic poweron can be sheduled once a day on specific time.

This solution is NOT usable if you want to start Mac mini immidetialy after power comes back on

0 Kudos