Update power.inc.sh
This commit is contained in:
@@ -674,17 +674,28 @@ HOSTPOWER(){
|
||||
c=0; MSG_SPC=''; spc1=`expr ${HC_CW} - ${#MSG}`; until [ ${c} = ${spc1} ]; do MSG_SPC="${MSG_SPC} "; ((c++)); done
|
||||
echo -en "\n${idsCL[LightCyan]}${MSG}${MSG_SPC}: "
|
||||
if [ "${TEST}" != "true" ]; then
|
||||
run=$(snmpset -v 1 -c private ${PW_APCPDU_IP} .1.3.6.1.4.1.318.1.1.12.3.3.1.1.4.14 i 1 >/dev/null 2>&1)
|
||||
sleep 3s
|
||||
echo -e "${idsCL[Green]}Done${idsCL[Default]}\n"
|
||||
current_status=$(snmpwalk -t 1 -r 0 -v 1 -c public ${PW_APCPDU_IP} .1.3.6.1.4.1.318.1.1.12.3.3.1.1.4.14 | sed 's/.*: //')
|
||||
if [ "${current_status}" != "" ] && [ "${current_status}" != "1" ]; then
|
||||
run=$(snmpset -v 1 -c private ${PW_APCPDU_IP} .1.3.6.1.4.1.318.1.1.12.3.3.1.1.4.14 i 1 >/dev/null 2>&1)
|
||||
sleep 3s
|
||||
echo -e "${idsCL[Green]}Done${idsCL[Default]}\n"
|
||||
elif [ "${current_status}" == "1" ]; then
|
||||
echo -e "${idsCL[Green]}SAS Enclosure Already Powered ON${idsCL[Default]}\n"
|
||||
fi
|
||||
else
|
||||
echo -e "${idsCL[Yellow]}(TEST MODE)${idsCL[Default]}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${TEST}" != "true" ]; then
|
||||
echo -e "${idsCL[Green]}"
|
||||
ipmitool -I lanplus -H ${idracip} -U ${PW_ESXI_USER} -P "${PW_ESXI_PASS}" chassis power ${2,,}
|
||||
current_status=$(ipmitool -I lanplus -H ${idracip} -U ${PW_ESXI_USER} -P "${PW_ESXI_PASS}" chassis power status | grep 'Power is on')
|
||||
if [ "${current_status}" == "" ]; then
|
||||
echo -e "${idsCL[Green]}"
|
||||
ipmitool -I lanplus -H ${idracip} -U ${PW_ESXI_USER} -P "${PW_ESXI_PASS}" chassis power ${2,,}
|
||||
else
|
||||
echo -e "\n${idsCL[LightCyan]}Host is already Powered ON${idsCL[Default]}\n\n"
|
||||
|
||||
fi
|
||||
else
|
||||
echo -e "\n${idsCL[Yellow]}(TEST MODE)"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user