Update powerwall.sh

This commit is contained in:
2023-12-14 17:42:05 -06:00
parent 20f34ca3cc
commit 700738fdf1

View File

@@ -593,18 +593,37 @@ ISCSISYSVMSHUTDOWN(){
}
HOSTPOWER(){
if [ "${PW_iDRACHOST_SHORTNAMES[${1}]}" != "" ]; then
idracip=${1}
elif [ "${PW_ESXI_HOST_NAMES[${1}]}" != "" ]; then
tmp=${PW_ESXI_HOST_NAMES[${1}]}
idracip=${PW_HOST_IDRACS[${tmp}]}
elif [ "${PW_HOST_IDRACS[iDS-vMS-Host${1}]}" != "" ]; then
idracip=${PW_HOST_IDRACS[iDS-vMS-Host${1}]}
elif [ "${PW_HOST_IDRACS[${1}]}" != "" ]; then
idracip=${PW_HOST_IDRACS[${1}]}
# if [ "${PW_iDRACHOST_SHORTNAMES[${1}]}" != "" ]; then
# idracip=${1}
# elif [ "${PW_ESXI_HOST_NAMES[${1}]}" != "" ]; then
# tmp=${PW_ESXI_HOST_NAMES[${1}]}
# idracip=${PW_HOST_IDRACS[${tmp}]}
# elif [ "${PW_HOST_IDRACS[iDS-vMS-Host${1}]}" != "" ]; then
# idracip=${PW_HOST_IDRACS[iDS-vMS-Host${1}]}
# elif [ "${PW_HOST_IDRACS[${1}]}" != "" ]; then
# idracip=${PW_HOST_IDRACS[${1}]}
# else
# idracip=''
# fi
if [ "${PW_iDRACHOST_SHORTNAMES[${HOST}]}" != "" ]; then
tmp=${PW_iDRACHOST_SHORTNAMES[${HOST}]}
ESXI_HOST=${PW_HOST_ADDRESSES[${tmp}]}
elif [ "${PW_ESXI_HOST_NAMES[${HOST}]}" != "" ]; then
ESXI_HOST=${HOST}
elif [ "${PW_HOST_ADDRESSES[iDS-vMS-Host${HOST}]}" != "" ]; then
ESXI_HOST=${PW_HOST_ADDRESSES[iDS-vMS-Host${HOST}]}
elif ([ "${HOST::1}" == "o" ] || [ "${HOST::1}" == "O" ]) && [ "${PW_HOST_ADDRESSES[OFF-vMS-Host${HOST: -1}]}" != "" ]; then
ESXI_HOST=${PW_HOST_ADDRESSES[OFF-vMS-Host${HOST: -1}]}
elif [ "${PW_HOST_ADDRESSES[${HOST}]}" != "" ]; then
ESXI_HOST=${PW_HOST_ADDRESSES[${HOST}]}
elif [ "${1^^}" == "ALL" ] || [ "${1^^}" == "MAINSITE" ] || [ "${1^^}" == "OFFSITE" ] || [ "${1^^}" == "MAIN" ] || [ "${1^^}" == "SYS" ]; then
ESXI_HOST=${HOST^^}
MN=1
else
idracip=''
ESXI_HOST=''
fi
[ "${ESXI_HOST}" != "" ] && idracip=${PW_HOST_IDRACS[${PW_ESXI_HOST_NAMES[${ESXI_HOST}]}]} || idracip=''
echo -e "\n${idsCL[Yellow]}POWERING ${2^^} '${PW_iDRACHOST_SHORTNAMES[${idracip}]}'"
DIVIDER . yellow 75