Update powerwall.sh

This commit is contained in:
2023-10-31 22:39:12 -05:00
parent aabe793ce7
commit 49e5cf0c78

View File

@@ -1117,21 +1117,23 @@ SHUTDOWN_SERVER(){
echo
echo "($datetime) - Shutting down ${host} (${hostip})" >> ${PW_LOGFILE}
echo -en "${idsCL[LightCyan]}Enabling Maintenance mode and will wait for iSCSI VM's to begin migrating ... "
if [ "${TEST}" != "true" ]; then
${PW_FOLDER}/esxi-scripts/host-maintenance_mode.ps1 ${PW_ESXI_HOST_NAMES[${hostip}]} & >/dev/null 2>&1
sleep 45s
fi
echo -en "${idsCL[LightCyan]}Enabling maintenance mode ... "
[ "${TEST}" != "true" ] && ${PW_FOLDER}/esxi-scripts/host-maintenance_mode.ps1 ${PW_ESXI_HOST_NAMES[${hostip}]} & >/dev/null 2>&1
echo -e "${idsCL[Green]}Done\n"
echo -en "${idsCL[LightCyan]}Giving time for iSCSI VM's to begin migration to other hosts ... "
[ "${TEST}" != "true" ] && sleep 45s || sleep 10s
echo -e "${idsCL[Green]}Done\n"
echo -en "${idsCL[LightCyan]}Shutting Down VM's on: ${host} (${hostip}) ... "
echo -en "${idsCL[LightCyan]}Shutting down remaining VM's on: ${host} (${hostip}) ... "
if [ "${TEST}" != "true" ]; then
${PW_FOLDER}/esxi-scripts/vm-shutdown.ps1 ${hostip} >/dev/null 2>&1
${PW_FOLDER}/esxi-scripts/iscsi-server-shutdown.ps1 ${hostip} >/dev/null 2>&1
fi
echo -e "${idsCL[Green]}Done\n"
echo -en "${idsCL[LightCyan]}Shutting Down Host: ${host} (${hostip}) ... "
echo -en "${idsCL[LightCyan]}Shutting down Host: ${host} (${hostip}) ... "
if [ "${TEST}" != "true" ]; then
ssh root@${hostip} 'esxcli system shutdown poweroff -d 10 -r "Automated ESXi host shutdown"' & >/dev/null 2>&1
ssh root@${hostip} 'esxcli system maintenanceMode set -e false -t 0' >/dev/null 2>&1