Update powerwall.sh

This commit is contained in:
2023-12-13 18:50:58 -06:00
parent b6f20da7b1
commit a6472a4bb7

View File

@@ -558,7 +558,7 @@ CHECKPOWER(){
esac
shift 1
done
[ "${avgdays}" = "0" ] && unset avgdays
[ "${avgdays}" == "0" ] && unset avgdays
[ "${avgdays}" != "" ] && avgdayshdr="${avgdays}-Day-Avg" || avgdayshdr=""
if ([ "${STYPE}" == "" ] || [ "${STYPE}" == "mainsite" ]) && [ "${PTYPE}" != "esxi" ]; then
@@ -1173,16 +1173,16 @@ STARTALL_SERVICES(){
echo
}
SERVICE_MNG(){
if [ "${2}" = "start" ]; then
if [ "${2}" == "start" ]; then
sa=Starting
elif [ "${2}" = "stop" ]; then
elif [ "${2}" == "stop" ]; then
sa=Stopping
elif [ "${2}" = "restart" ]; then
elif [ "${2}" == "restart" ]; then
sa=Restarting
elif [ "${2}" = "status" ]; then
elif [ "${2}" == "status" ]; then
sa='Status for'
fi
@@ -2377,7 +2377,10 @@ fi
get-snapshots) GET_SNAPSHOTS;;
service)
if [ "${2}" = "all" ]; then
if [ "${2}" == "status" ]; then
CHECK_SERVICES
elif [ "${2}" == "all" ]; then
if [ "${3}" == "stop" ]; then
STOPALL_SERVICES
elif [ "${3}" == "start" ]; then
@@ -2388,40 +2391,40 @@ fi
CHECK_SERVICES
fi
else
if [ "${3}" = "start" ] || [ "${3}" = "" ]; then
if [ "${3}" == "start" ] || [ "${3}" == "" ]; then
echo "start: ${1}"
if [ "${2}" = "temp" ]; then
if [ "${2}" == "temp" ]; then
# SENDNOTICE "Temp Monitor Startup" "$(DAILYTEMP)" &
CHECKTEMP_SERVICE
elif [ "${2}" = "power" ]; then
elif [ "${2}" == "power" ]; then
CHECKPOWER_SERVICE
elif [ "${2}" = "powerlogger" ]; then
elif [ "${2}" == "powerlogger" ]; then
POWERLOGGER_SERVICE
fi
elif [ "${3}" = "stop" ]; then
if [ "${2}" = "temp" ]; then
elif [ "${3}" == "stop" ]; then
if [ "${2}" == "temp" ]; then
STOP_SERVICE temp
for SENSOR in ${!PW_SENSOR_ID[@]}; do
logtemp=${PW_LOGFOLDER}/log-temp-${SENSOR}
echo "(`date +'%Y-%m-%d %H:%M:%S'`) - ${SENSOR} - Service Stopped" >> ${logtemp}
done
elif [ "${2}" = "power" ]; then
elif [ "${2}" == "power" ]; then
STOP_SERVICE power
echo "(`date +'%Y-%m-%d %H:%M:%S'`) Service Stopped" >> ${PW_LOGPOWER}
elif [ "${2}" = "powerlogger" ]; then
elif [ "${2}" == "powerlogger" ]; then
STOP_SERVICE powerlogger
fi
elif [ "${3}" = "restart" ]; then
elif [ "${3}" == "restart" ]; then
SERVICE_MNG ${2} stop
sleep 2s
SERVICE_MNG ${2} start
elif [ "${3}" = "status" ]; then
elif [ "${3}" == "status" ]; then
srvc=${PW_POWERWALL_SERVICES[${2}]}
c=0; spc=''; spc1=`expr 25 - ${#srvc}`; until [ ${c} = ${spc1} ]; do spc="${spc} "; c=`expr ${c} + 1`; done
echo -e "${idsCL[LightCyan]}${srvc}${spc}: "