Update power.inc.sh

This commit is contained in:
2025-06-03 17:49:21 -05:00
parent f0802d1885
commit 9996ba755f

View File

@@ -1008,8 +1008,9 @@ OFFSITE_CHECKPOWER_SERVICE(){
TESTMSG=""
fi
upsinfo=$(upsc offsite-ups)
# upsinfo=$(upsc offsite-ups 2>&1)
# upsinfo=$(upsc offsite-ups)
upsinfo=$(upsc offsite-ups 2>&1)
echo "HERE1: $upsinfo"
if [ "$(echo "${upsinfo}" | grep 'input.voltage:' | sed 's/.*: //')" != "" ]; then
rm -f ${PW_TMPFOLDER}/power.offsite.ups.losscomm
OFFSITE_VOLTIN=$(echo "${upsinfo}" | grep 'input.voltage:' | sed 's/.*: //')
@@ -1140,7 +1141,8 @@ AMBIENT TEMP: ${OFFSITE_TEMP}'F"
elif [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/power.offsite.ups.losscomm)) -ge 120 ]; then
echo "($(date +'%Y-%m-%d %H:%M:%S')) - 0.0'V - 0'% Battery - Restarting NUT service" >> ${PW_LOGFILE}
systemctl restart /usr/lib/systemd/system/nut-driver.service
echo "HERE2: $upsinfo"
# systemctl restart /usr/lib/systemd/system/nut-driver.service
sleep 10s
touch ${PW_TMPFOLDER}/power.offsite.ups.losscomm
fi