Update powerwall.sh

This commit is contained in:
2023-12-03 13:36:05 -06:00
parent 169ac14278
commit 1a06c7fdf7

View File

@@ -1569,6 +1569,12 @@ HOSTPOWER(){
}
PDUCONTROL(){
function exitspacing {
echo -e "\n\033[K\n\033[K"
exit 0
}
trap exitspacing EXIT
while [ $# -gt 0 ]; do
case "$1" in
-port) PORT_SEL=${2};;
@@ -1594,6 +1600,13 @@ PDUCONTROL(){
echo -e "${pp}) ${idsCL[LightCyan]}${port}${spc}${idsCL[Default]}: ${portpower_disp}${idsCL[Default]}"
((p++))
done
echo -e ""
echo -e ""
echo -e ""
echo -e "((${idsCL[Yellow]}E${idsCL[Default]})xit"
echo -e ""
echo -e ""
echo -e "\033[7A"
until [ "${PORTSEL}" != "" ]; do
echo -en "\n${idsCL[LightCyan]}Enter the port number to control: ${idsCL[Default]}"
read PORTSEL
@@ -1601,6 +1614,8 @@ PDUCONTROL(){
done
fi
[ "${PORTSEL^^}" == "E" ] && echo -e "\n\033[K\n\033[K" && exit 0
portsel_power=$(snmpwalk -t 1 -r 0 -v 1 -c public ${PW_APCPDU_IP} .1.3.6.1.4.1.318.1.1.12.3.3.1.1.4.${PORTSEL} -O vq 2> /dev/null | sed -e 's/"//g')
[ ${portsel_power} -eq 2 ] && portsel_power_disp="${idsCL[Green]}ON" || portsel_power_disp="${idsCL[LightRed]}OFF"