ESXi UPS shutdown script
        
          1 minute read
        
      
      ESXi UPS shutdown script
How to shutdown ESXi safely when a UPS is on battery.
esxi-ups-shutdown.sh
Replace "PASSWORD" with the ESXi server password and replace SERVERIP with the ESXi servers IP.
#!/bin/bash
sshpass -p "PASSWORD" ssh -o StrictHostKeyChecking=no root@SERVERIP < esxi-ups-payload.sh
esxi-ups-payload.sh
#!/bin/bash
echo "$(date) - UPS started ESXi shutdown" >> esxi-ups-log.txt
poweroff
The poweroff command is fine for ESXi version 4 and above: https://kb.vmware.com/s/article/1013193
        I  feedback.
Let me know what you think of this article on twitter @M3PGS or leave a comment below!
      
      
      Let me know what you think of this article on twitter @M3PGS or leave a comment below!
          
          comments powered by Disqus