Update powerwall.sh
This commit is contained in:
54
powerwall.sh
54
powerwall.sh
@@ -672,33 +672,33 @@ CHECKPOWER(){
|
|||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
finalcheck=""
|
# finalcheck=""
|
||||||
until [ "${finalcheck}" != "" ]; do
|
# until [ "${finalcheck}" != "" ]; do
|
||||||
for hostfile in ${PW_TMPFOLDER}/*.hostpower; do
|
# for hostfile in ${PW_TMPFOLDER}/*.hostpower; do
|
||||||
if [ -f ${hostfile} ] && [ "${hostfile}" != "${PW_TMPFOLDER}/*.hostpower" ]; then
|
# if [ -f ${hostfile} ] && [ "${hostfile}" != "${PW_TMPFOLDER}/*.hostpower" ]; then
|
||||||
host=${hostfile%.*}; host=${host##*/}
|
# host=${hostfile%.*}; host=${host##*/}
|
||||||
if [ "${host}" != "*" ] && [ "${host}" != "done" ]; then
|
# if [ "${host}" != "*" ] && [ "${host}" != "done" ]; then
|
||||||
watts=$(cat ${hostfile})
|
# watts=$(cat ${hostfile})
|
||||||
if [ "${watts}" == "down" ]; then
|
# if [ "${watts}" == "down" ]; then
|
||||||
hostpower="${idsCL[LightRed]}Host Offline"
|
# hostpower="${idsCL[LightRed]}Host Offline"
|
||||||
elif [ "${watts}" == "0" ]; then
|
# elif [ "${watts}" == "0" ]; then
|
||||||
hostpower="${idsCL[Default]}n/a"
|
# hostpower="${idsCL[Default]}n/a"
|
||||||
else
|
# else
|
||||||
[[ "${watts}" == *"."* ]] && [[ "${watts}" != *".0"* ]] && watts=`printf "%'.2f\n" ${watts}` || watts=`printf "%'.0f\n" ${watts}`
|
# [[ "${watts}" == *"."* ]] && [[ "${watts}" != *".0"* ]] && watts=`printf "%'.2f\n" ${watts}` || watts=`printf "%'.0f\n" ${watts}`
|
||||||
hostpower="${idsCL[Green]}${watts}'W"
|
# hostpower="${idsCL[Green]}${watts}'W"
|
||||||
fi
|
# fi
|
||||||
echo -e "${idsCL[LightCyan]}${PW_iDRACHOST_SHORTNAMES[${host}]} ${idsCL[Default]}: ${hostpower}${idsCL[Default]}"
|
# echo -e "${idsCL[LightCyan]}${PW_iDRACHOST_SHORTNAMES[${host}]} ${idsCL[Default]}: ${hostpower}${idsCL[Default]}"
|
||||||
|
#
|
||||||
mv ${hostfile} ${hostfile}.done
|
# mv ${hostfile} ${hostfile}.done
|
||||||
|
#
|
||||||
elif [ "${host}" == "done" ]; then
|
# elif [ "${host}" == "done" ]; then
|
||||||
finalcheck=done
|
# finalcheck=done
|
||||||
rm -f ${PW_TMPFOLDER}/*.hostpower*
|
# rm -f ${PW_TMPFOLDER}/*.hostpower*
|
||||||
fi
|
# fi
|
||||||
fi
|
# fi
|
||||||
done
|
# done
|
||||||
sleep 0.25
|
# sleep 0.25
|
||||||
done
|
# done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
end=`date +%s`; runtime=$((end-start)); echo -e "\nruntime: ${runtime}"
|
end=`date +%s`; runtime=$((end-start)); echo -e "\nruntime: ${runtime}"
|
||||||
|
|||||||
Reference in New Issue
Block a user