Update powerwall.sh

This commit is contained in:
2023-10-31 20:37:42 -05:00
parent 58c51c22cf
commit 35462418df

View File

@@ -622,10 +622,13 @@ CHECKPOWER(){
host=${hostfile%.*}; host=${host##*/}
if [ "${host}" != "*" ] && [ "${host}" != "done" ]; then
watts=$(cat ${hostfile})
[[ "${watts}" == *"."* ]] && [[ "${watts}" != *".0"* ]] && watts=`printf "%'.1f\n" ${watts}` || watts=`printf "%'.0f\n" ${watts}`
if [ "${watts}" == "down" ]; then hostpower="${idsCL[Red]}Host Offline"
elif [ "${watts}" == "0" ]; then hostpower="${idsCL[Default]}n/a"
else hostpower="${idsCL[Green]}${watts}'W"
if [ "${watts}" == "down" ]; then
hostpower="${idsCL[Red]}Host Offline"
elif [ "${watts}" == "0" ]; then
hostpower="${idsCL[Default]}n/a"
else
[[ "${watts}" == *"."* ]] && [[ "${watts}" != *".0"* ]] && watts=`printf "%'.1f\n" ${watts}` || watts=`printf "%'.0f\n" ${watts}`
hostpower="${idsCL[Green]}${watts}'W"
fi
echo -e "${idsCL[LightCyan]}HOST '${PW_iDRACHOST_SHORTNAMES[${host}]}' ${idsCL[Default]}: ${hostpower}${idsCL[Default]}"
mv ${hostfile} ${hostfile}.done