From 8638b25caa8f86e79f128a49fd48fc62af4e8a13 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sat, 4 Nov 2023 09:38:38 -0500 Subject: [PATCH] Update powerwall.sh --- powerwall.sh | 54 ++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/powerwall.sh b/powerwall.sh index 53afdaaf..ba7254d3 100755 --- a/powerwall.sh +++ b/powerwall.sh @@ -672,33 +672,33 @@ CHECKPOWER(){ done - finalcheck="" - until [ "${finalcheck}" != "" ]; do - for hostfile in ${PW_TMPFOLDER}/*.hostpower; do - if [ -f ${hostfile} ] && [ "${hostfile}" != "${PW_TMPFOLDER}/*.hostpower" ]; then - host=${hostfile%.*}; host=${host##*/} - if [ "${host}" != "*" ] && [ "${host}" != "done" ]; then - watts=$(cat ${hostfile}) - if [ "${watts}" == "down" ]; then - hostpower="${idsCL[LightRed]}Host Offline" - elif [ "${watts}" == "0" ]; then - hostpower="${idsCL[Default]}n/a" - else - [[ "${watts}" == *"."* ]] && [[ "${watts}" != *".0"* ]] && watts=`printf "%'.2f\n" ${watts}` || watts=`printf "%'.0f\n" ${watts}` - hostpower="${idsCL[Green]}${watts}'W" - fi - echo -e "${idsCL[LightCyan]}${PW_iDRACHOST_SHORTNAMES[${host}]} ${idsCL[Default]}: ${hostpower}${idsCL[Default]}" - - mv ${hostfile} ${hostfile}.done - - elif [ "${host}" == "done" ]; then - finalcheck=done - rm -f ${PW_TMPFOLDER}/*.hostpower* - fi - fi - done - sleep 0.25 - done + # finalcheck="" + # until [ "${finalcheck}" != "" ]; do + # for hostfile in ${PW_TMPFOLDER}/*.hostpower; do + # if [ -f ${hostfile} ] && [ "${hostfile}" != "${PW_TMPFOLDER}/*.hostpower" ]; then + # host=${hostfile%.*}; host=${host##*/} + # if [ "${host}" != "*" ] && [ "${host}" != "done" ]; then + # watts=$(cat ${hostfile}) + # if [ "${watts}" == "down" ]; then + # hostpower="${idsCL[LightRed]}Host Offline" + # elif [ "${watts}" == "0" ]; then + # hostpower="${idsCL[Default]}n/a" + # else + # [[ "${watts}" == *"."* ]] && [[ "${watts}" != *".0"* ]] && watts=`printf "%'.2f\n" ${watts}` || watts=`printf "%'.0f\n" ${watts}` + # hostpower="${idsCL[Green]}${watts}'W" + # fi + # echo -e "${idsCL[LightCyan]}${PW_iDRACHOST_SHORTNAMES[${host}]} ${idsCL[Default]}: ${hostpower}${idsCL[Default]}" + # + # mv ${hostfile} ${hostfile}.done + # + # elif [ "${host}" == "done" ]; then + # finalcheck=done + # rm -f ${PW_TMPFOLDER}/*.hostpower* + # fi + # fi + # done + # sleep 0.25 + # done fi end=`date +%s`; runtime=$((end-start)); echo -e "\nruntime: ${runtime}"