From 2ddb9ad011e47891985a370986c06d370939f6aa Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 31 Oct 2023 21:23:30 -0500 Subject: [PATCH] Update powerwall.sh --- powerwall.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/powerwall.sh b/powerwall.sh index 268c95e1..462e74c5 100755 --- a/powerwall.sh +++ b/powerwall.sh @@ -1140,6 +1140,27 @@ ISCSISYSVMSHUTDOWN(){ echo } +HOSTPOWER(){ + if [ "${PW_iDRACHOST_SHORTNAMES[${1}]}" != "" ]; then + idracip=${1} + elif [ "${PW_HOST_IDRACS[${1}]}" != "" ]; then + idracip=${PW_HOST_IDRACS[${1}]} + else + idracip='' + fi + + if [ "${idracip}" != "" ]; then + if [ "${2,,}" == "on" ] || [ "${2,,}" == "off" ] || [ "${2,,}" == "status" ]; then + ssh root@${PW_RACADM_ACCESS} ipmitool -I lanplus -H ${idracip} -U ${PW_ESXI_USER} -P "'${PW_ESXI_PASS}'" chassis power ${2,,} + else + echo -e "${idsCL[LightCyan]}'${2,,}' command is not recognized${idsCL[Default]}" + fi + else + echo -e "${idsCL[LightCyan]}Host does not exist${idsCL[Default]}" + fi + echo +} + LOGROTATE(){ # STOPALL_SERVICES lm=`expr $(date +'%m') - 1` @@ -1248,6 +1269,7 @@ fi ;; shutdownhost) SHUTDOWN_SERVER ${2};; shutdown_servers) SHUTDOWN_SERVERS ${2};; + hostpower) HOSTPOWER ${2} ${3};; get-snapshots) GET_SNAPSHOTS;;