Update powerwall.sh
This commit is contained in:
29
powerwall.sh
29
powerwall.sh
@@ -1593,15 +1593,7 @@ HOSTMGMT(){
|
||||
echo -e "\n${idsCL[Yellow]}Host Controls${idsCL[Default]}"
|
||||
DIVIDER . yellow 75
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
-h|-host) HOST="${2}";;
|
||||
-p|-power) POWER=${2}; MODE="power";;
|
||||
-e|-esxi) ESXI=${2}; MODE="esxi";;
|
||||
esac
|
||||
shift 1
|
||||
done
|
||||
|
||||
HOST=${1}
|
||||
if [ "${PW_iDRACHOST_SHORTNAMES[${HOST}]}" != "" ]; then
|
||||
tmp=${PW_iDRACHOST_SHORTNAMES[${HOST}]}
|
||||
ESXIHOST=${PW_HOST_ADDRESSES[${tmp}]}
|
||||
@@ -1609,7 +1601,7 @@ HOSTMGMT(){
|
||||
ESXIHOST=${HOST}
|
||||
elif [ "${PW_HOST_IDRACS[iDS-vMS-Host${HOST}]}" != "" ]; then
|
||||
ESXIHOST=${PW_HOST_ADDRESSES[iDS-vMS-Host${HOST}]}
|
||||
elif [ "${PW_HOST_IDRACS[${HOST}]}" != "" ]; then
|
||||
elif [ "${PW_HOST_ADDRESSES[${HOST}]}" != "" ]; then
|
||||
ESXIHOST=${PW_HOST_ADDRESSES[${HOST}]}
|
||||
else
|
||||
ESXIHOST=''
|
||||
@@ -1617,6 +1609,23 @@ HOSTMGMT(){
|
||||
[ "${ESXIHOST}" == "" ] && echo -e "Invalid host\n" && exit 1
|
||||
tmp=${PW_ESXI_HOST_NAMES[${ESXIHOST}]}
|
||||
idracip=${PW_HOST_IDRACS[${tmp}]}
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
-p|-power) POWER=${2}; MODE="power";;
|
||||
-e|-esxi) ESXI=${2}; MODE="esxi";;
|
||||
-h)
|
||||
echo -e "Usage: ${idsCL[Yellow]}pw host {host} {opts}${idsCL[Default]} {"
|
||||
width=35
|
||||
printf "%-${width}s- %s\n" " {host}" "(*required, can either be esxiIP,idracIP or Host#)"
|
||||
printf "%-${width}s- %s\n" " -p|-power {on / off}" "Controls Host Power"
|
||||
printf "%-${width}s- %s\n" " -e|-esxi {off / mm}" "Shuts down ESXi or puts into maintenance mode"
|
||||
echo -e "}\n"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
shift 1
|
||||
done
|
||||
|
||||
hostname=${PW_iDRACHOST_SHORTNAMES[${idracip}]}
|
||||
c=0; spcA=''; spc1=`expr 21 - ${#hostname} - 1`; until [ ${c} = ${spc1} ]; do spcA="${spcA} "; c=`expr ${c} + 1`; done
|
||||
|
||||
Reference in New Issue
Block a user