Update powerwall.sh
This commit is contained in:
28
powerwall.sh
28
powerwall.sh
@@ -156,6 +156,12 @@ CHECKTEMP_SERVICE(){
|
|||||||
declare -A last_temp
|
declare -A last_temp
|
||||||
while true; do
|
while true; do
|
||||||
|
|
||||||
|
if [ ! -f ${PW_TMPFOLDER}/temp.* ] && [ $(date +%H)$(date +%M) -ge 0700 ] && [ $(date +%H)$(date +%M) -lt 0705 ]; then
|
||||||
|
if [ ! -f ${PW_TMPFOLDER}/.sentdaily ] || [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.sentdaily)) -gt 600 ]; then
|
||||||
|
touch ${PW_TMPFOLDER}/.sentdaily
|
||||||
|
SENDNOTICE "Daily Temp Readings" "$(DAILYTEMP)" &
|
||||||
|
fi
|
||||||
|
fi
|
||||||
for SENSORa in ${PW_SENSOR_ORD[@]}; do
|
for SENSORa in ${PW_SENSOR_ORD[@]}; do
|
||||||
logtemp=${PW_LOGFOLDER}/log-temp-${SENSORa}
|
logtemp=${PW_LOGFOLDER}/log-temp-${SENSORa}
|
||||||
[ ! -f ${logtemp} ] && touch ${logtemp}
|
[ ! -f ${logtemp} ] && touch ${logtemp}
|
||||||
@@ -276,13 +282,6 @@ Shutting down system servers!!" 1
|
|||||||
echo -e "($datetime) - ${temp_f}'F - Shutting down SYS servers" >> ${logtemp}
|
echo -e "($datetime) - ${temp_f}'F - Shutting down SYS servers" >> ${logtemp}
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ ! -f ${PW_TMPFOLDER}/temp.* ] && [ $(date +%H)$(date +%M) -ge 0700 ] && [ $(date +%H)$(date +%M) -lt 0705 ]; then
|
|
||||||
if [ ! -f ${PW_TMPFOLDER}/.${SENSOR}.sentdaily ] || [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/.${SENSOR}.sentdaily)) -gt 600 ]; then
|
|
||||||
rm -f ${PW_TMPFOLDER}/.${SENSOR}.sentdaily
|
|
||||||
touch ${PW_TMPFOLDER}/.${SENSOR}.sentdaily
|
|
||||||
SENDNOTICE "Daily Temp Readings" "$(DAILYTEMP)" &
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ${last_temp[${SENSOR}]} -gt 1 ]; then
|
if [ ${last_temp[${SENSOR}]} -gt 1 ]; then
|
||||||
SENDNOTICE "${SENSOR} BACK TO NORMAL" "($datetime) NORMAL TEMP: ${temp_f}'F
|
SENDNOTICE "${SENSOR} BACK TO NORMAL" "($datetime) NORMAL TEMP: ${temp_f}'F
|
||||||
@@ -293,8 +292,8 @@ Previous Temp: ${last_temp[${SENSOR}]}'F"
|
|||||||
[ "$(compgen -G "${PW_FOLDER}/shutdown.*")" != "" ] && rm -f ${PW_FOLDER}/shutdown.*
|
[ "$(compgen -G "${PW_FOLDER}/shutdown.*")" != "" ] && rm -f ${PW_FOLDER}/shutdown.*
|
||||||
|
|
||||||
elif [ ${last_temp[${SENSOR}]} -eq 0 ]; then
|
elif [ ${last_temp[${SENSOR}]} -eq 0 ]; then
|
||||||
SENDNOTICE "${SENSOR} TEMP NORMAL" "($datetime) Service Startup
|
# SENDNOTICE "${SENSOR} TEMP NORMAL" "($datetime) Service Startup
|
||||||
NORMAL TEMP: ${temp_f}'F"
|
# NORMAL TEMP: ${temp_f}'F"
|
||||||
echo -e "($datetime) - ${temp_f}'F - Service Startup - NORMAL TEMP" >> ${logtemp}
|
echo -e "($datetime) - ${temp_f}'F - Service Startup - NORMAL TEMP" >> ${logtemp}
|
||||||
echo -e "($datetime) - ${temp_f}'F - ${SENSOR} - Service Startup" >> ${PW_LOGFILE}
|
echo -e "($datetime) - ${temp_f}'F - ${SENSOR} - Service Startup" >> ${PW_LOGFILE}
|
||||||
[ "$(compgen -G "${PW_FOLDER}/shutdown.*")" != "" ] && rm -f ${PW_FOLDER}/shutdown.*
|
[ "$(compgen -G "${PW_FOLDER}/shutdown.*")" != "" ] && rm -f ${PW_FOLDER}/shutdown.*
|
||||||
@@ -967,9 +966,14 @@ fi
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ "${3}" = "start" ] || [ "${3}" = "" ]; then
|
if [ "${3}" = "start" ] || [ "${3}" = "" ]; then
|
||||||
[ "${2}" = "temp" ] && CHECKTEMP_SERVICE
|
if [ "${2}" = "temp" ]; then
|
||||||
[ "${2}" = "power" ] && CHECKPOWER_SERVICE
|
SENDNOTICE "Temp Monitor Startup" "$(DAILYTEMP)" &
|
||||||
[ "${2}" = "powerlogger" ] && POWERLOGGER_SERVICE
|
CHECKTEMP_SERVICE
|
||||||
|
elif [ "${2}" = "power" ]; then
|
||||||
|
CHECKPOWER_SERVICE
|
||||||
|
elif [ "${2}" = "powerlogger" ]; then
|
||||||
|
POWERLOGGER_SERVICE
|
||||||
|
fi
|
||||||
|
|
||||||
elif [ "${3}" = "stop" ]; then
|
elif [ "${3}" = "stop" ]; then
|
||||||
if [ "${2}" = "temp" ]; then
|
if [ "${2}" = "temp" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user