From a75afffbbe82fcdf856f857634bd00966cda8f24 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Wed, 3 Jan 2024 11:28:30 -0600 Subject: [PATCH] Update powerwall.sh --- powerwall.sh | 49 +++++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/powerwall.sh b/powerwall.sh index 187a37e5..8468a3ff 100755 --- a/powerwall.sh +++ b/powerwall.sh @@ -752,28 +752,33 @@ fi checkpower) CHECKPOWER ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10};; check) ([ "${2}" == "" ] || ([ "${2}" != "power" ] && [ "${2}" != "temp" ])) && checkrun="-help" || checkrun=${2} - case ${checkrun} in - power) CHECKPOWER ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10};; - temp) CHECKTEMP ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10};; - -h|-help) - echo -e "\nUsage: ${idsCL[Yellow]}[powerwall or pw] ${idsCL[LightYellow]}check ${idsCL[LightCyan]}{type} {flags} ${idsCL[Default]} {\n" - width=35 - printf "%-${width}s- %s\n" " {type}" "{power or temp} To check either power or temperatures" - echo -e "\n ${idsCL[LightCyan]}power${idsCL[Default]} {flag} options" - printf "%-${width}s- %s\n" " -a|-avg {#days}" "Show average values for X number of days" - printf "%-${width}s- %s\n" " -m|-mainsite" "Narrow to Mainsite Equipment" - printf "%-${width}s- %s\n" " -o|-offsite" "Narrow to Offsite Equipment" - printf "%-${width}s- %s\n" " -p|-power" "Narrow to Power Equipment" - printf "%-${width}s- %s\n" " -e|-esxi" "Narrow to ESXi Hosts" - echo -e "\n ${idsCL[LightCyan]}temp${idsCL[Default]} {flag} options" - printf "%-${width}s- %s\n" " -a|-avg {#days}" "Show average values for X number of days" - printf "%-${width}s- %s\n" " -S|-sensors" "Narrow to Sensors Only" - printf "%-${width}s- %s\n" " -e|-esxi" "Narrow to ESXi Hosts Only" - printf "%-${width}s- %s\n" " -s|-search" "Narrow to search of sensor name" - echo -e "}\n" - exit 0 - ;; - esac + if [ "${3}" == "" ]; then + CHECKPOWER + CHECKTEMP + else + case ${checkrun} in + power) CHECKPOWER ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10};; + temp) CHECKTEMP ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10};; + -h|-help) + echo -e "\nUsage: ${idsCL[Yellow]}[powerwall or pw] ${idsCL[LightYellow]}check ${idsCL[LightCyan]}{type} {flags} ${idsCL[Default]} {\n" + width=35 + printf "%-${width}s- %s\n" " {type}" "{power or temp} To check either power or temperatures" + echo -e "\n ${idsCL[LightCyan]}power${idsCL[Default]} {flag} options" + printf "%-${width}s- %s\n" " -a|-avg {#days}" "Show average values for X number of days" + printf "%-${width}s- %s\n" " -m|-mainsite" "Narrow to Mainsite Equipment" + printf "%-${width}s- %s\n" " -o|-offsite" "Narrow to Offsite Equipment" + printf "%-${width}s- %s\n" " -p|-power" "Narrow to Power Equipment" + printf "%-${width}s- %s\n" " -e|-esxi" "Narrow to ESXi Hosts" + echo -e "\n ${idsCL[LightCyan]}temp${idsCL[Default]} {flag} options" + printf "%-${width}s- %s\n" " -a|-avg {#days}" "Show average values for X number of days" + printf "%-${width}s- %s\n" " -S|-sensors" "Narrow to Sensors Only" + printf "%-${width}s- %s\n" " -e|-esxi" "Narrow to ESXi Hosts Only" + printf "%-${width}s- %s\n" " -s|-search" "Narrow to search of sensor name" + echo -e "}\n" + exit 0 + ;; + esac + fi ;; test) # while IFS=$'\t' read id date hum ;do