ESXi UPS shutdown script

by on under programming
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

comments powered by Disqus