This commit is contained in:
2023-11-04 13:38:14 -05:00
parent 345bb90ea5
commit be08457afe
2 changed files with 9 additions and 14 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
VERS='2.3.150-11042023'
VERS='2.3.152-11042023'
noheader=' update service dailytemp '

View File

@@ -209,8 +209,7 @@ CHECKTEMP_SERVICE(){
for SENSORa in ${PW_SENSOR_ORD[@]}; do
logtemp=${PW_LOGFOLDER}/log-temp-${SENSORa}
[ ! -f ${logtemp} ] && touch ${logtemp}
logtime=$(expr `date +%s` - $(stat -c %Y ${logtemp}))
[ ${logtime} -ge 3600 ] && relog=1 || relog=0
[ $(expr `date +%s` - $(stat -c %Y ${logtemp})) -ge 3600 ] && relog=1 || relog=0
if ([ "${PW_REMOTE_SENSORS[${SENSORa}]}" != "" ] && [ "$(CHECK_HOST ${PW_REMOTE_SENSORS[${SENSORa}]})" != "false" ]) || ([ "${PW_HOST_ADDRESSES[${SENSORa}]}" != "" ] && [ "$(CHECK_HOST ${PW_HOST_ADDRESSES[${SENSORa}]})" != "false" ]); then
# if ([ "${PW_REMOTE_SENSORS[${SENSORa}]}" != "" ] && [ "$(CHECK_HOST ${PW_REMOTE_SENSORS[${SENSORa}]})" != "false" ]); then
@@ -629,7 +628,7 @@ CHECKPOWER_SERVICE(){
voltstatus=0
battstatus=0
while true; do
INVSTATSINFO=$(curl -s "https://inv1.scity.us/stats.json")
INVSTATSINFO=$(curl -s "http://${PW_INVERTER_IP}/stats.json")
if [ "${INVSTATSINFO}" != "" ]; then
INPUTACV=$(echo ${INVSTATSINFO} | jq '.inputs .inV')
@@ -644,8 +643,7 @@ VOLTAGE: ${INPUTACV}'V"
echo -e "(${datetime}) - ${INPUTACV}'V - POWER NOMINAL AGAIN" >> ${PW_LOGFILE}
battstatus=0
else
errtime=$(expr `date +%s` - $(stat -c %Y ${PW_LOGPOWER}))
[ ${errtime} -ge 3600 ] && echo "(${datetime}) - ${INPUTACV}'V - Normal Voltage" >> ${PW_LOGPOWER}
[ $(expr `date +%s` - $(stat -c %Y ${PW_LOGPOWER})) -ge 3600 ] && echo "(${datetime}) - ${INPUTACV}'V - Normal Voltage" >> ${PW_LOGPOWER}
if [ ${voltstatus} -eq 0 ]; then
SENDNOTICE "Power Nominal" "(${datetime}) Service Startup
Normal voltage detected
@@ -697,8 +695,7 @@ Shutting down all servers" 1
fi
else
errtime=$(expr `date +%s` - $(stat -c %Y ${PW_LOGPOWER}))
[ ${errtime} -ge 3600 ] && echo "(${datetime}) - ${BATTVOLT}'V - Battery Voltage" >> ${PW_LOGPOWER}
[ $(expr `date +%s` - $(stat -c %Y ${PW_LOGPOWER})) -ge 3600 ] && echo "(${datetime}) - ${BATTVOLT}'V - Battery Voltage" >> ${PW_LOGPOWER}
if [ ${battstatus} -eq 0 ]; then
echo "(${datetime}) - Battery: ${BATTVOLT}'V - Service Startup - Normal voltage detected" >> ${PW_LOGPOWER}
fi
@@ -733,15 +730,13 @@ Shutting down all servers" 1
VOLTAGE: ${OFFSITE_VOLTIN}'V"
rm -f ${PW_TMPFOLDER}/power.offsite.*
else
errtime=$(expr `date +%s` - $(stat -c %Y ${PW_LOGPOWER}))
[ ${errtime} -le 300 ] && echo "(${datetime}) - ${OFFSITE_VOLTIN}'V - Offsite Normal Voltage" >> ${PW_LOGPOWER}
[ $(expr `date +%s` - $(stat -c %Y ${PW_LOGPOWER})) -le 300 ] && echo "(${datetime}) - ${OFFSITE_VOLTIN}'V - Offsite Normal Voltage" >> ${PW_LOGPOWER}
fi
else
echo "(${datetime}) - ${OFFSITE_VOLTIN}'V - OFFSITE POWER OFF/LOW POWER" >> ${PW_LOGPOWER}
echo "(${datetime}) - ${OFFSITE_VOLTIN}'V - OFFSITE POWER OFF/LOW POWER" >> ${PW_LOGFILE}
errtime=$(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/power.offsite.ac.low))
if [ ! -f ${PW_TMPFOLDER}/power.offsite.ac.low ] || [ ${errtime} -ge 300 ]; then
if [ ! -f ${PW_TMPFOLDER}/power.offsite.ac.low ] || [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/power.offsite.ac.low)) -ge 300 ]; then
SENDNOTICE "OFFSITE POWER ALERT - POWER OFF/LOW!!" "(${datetime}) Power off or low voltage detected
VOLTAGE: ${OFFSITE_VOLTIN}'V" 1
touch ${PW_TMPFOLDER}/power.offsite.ac.low
@@ -763,8 +758,8 @@ POWERLOGGER_SERVICE(){
while true; do
datetime=`date +'%Y-%m-%d %H:%M:%S'`
if [ "$(CHECK_HOST inv1.scity.us)" != "false" ]; then
INVSTATSINFO=$(curl -s "https://inv1.scity.us/stats.json")
INVSTATSINFO=$(curl -s "http://${PW_INVERTER_IP}/stats.json")
if [ "${INVSTATSINFO}" != "" ]; then
INPUTV=`echo ${INVSTATSINFO} | jq '.inputs .inV'`
INPUTA=`echo ${INVSTATSINFO} | jq '.inputs .inA'`
OUTPUTV=`echo ${INVSTATSINFO} | jq '.outputs .outV'`