From 35462418df242589daa673494df955c90b4f2e4a Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Tue, 31 Oct 2023 20:37:42 -0500 Subject: [PATCH] Update powerwall.sh --- powerwall.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/powerwall.sh b/powerwall.sh index 290c92bb..6d23bcf0 100755 --- a/powerwall.sh +++ b/powerwall.sh @@ -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