2 Replies Latest reply on Aug 21, 2019 10:36 AM by ppsilva02

    Gracefully shutdown ESXi 6.7 with a script via SSH without entering maintenance mode

    ppsilva02 Lurker

      I'm trying to write a (Python) script that ssh's to an ESXi 6.7 and shuts down the host and also shuts down the VMs according to the current system shutdown policy.

      I'm running Dell customized image ESXi 6.7 in a Dell R710 with a dual Xeon X5650 and 144GB RAM and a Dell R720 with a dual Xeon E5-2660.

      In fact what I want is the same that I can get with:


      Shutdown via GUI



      or Shutdown via console


      I have ssh enabled in the server.


      I already tryed:

      1) host_shutdown.sh (it just gets there indefinitely).

      2) /bin/host_shutdown.sh (it to gets there indefinitely).

      3) halt (shutdowns the server but it does not shuts down the VMs)


      I also tried:

      esxcli system shutdown poweroff --reason I_want_IT


      but the system must be in maintenance mode and I want to do it without entering maintenance mode.


      After digging a lot I found a way to shutdown the hosts:


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


      It in fact shuts down the hosts, but I don't know if it is a safe way to.


      I really would appreciate some opinion about it.

      Kind regards,