Update offsite-power-check.sh

This commit is contained in:
2023-11-05 15:28:28 -06:00
parent df2fd8d4af
commit 2ae0e5fce9

View File

@@ -33,7 +33,7 @@ $(date)"
while true; do
upsinfo=$(upsc CP1500PFCLCD)
echo "HERE: ${upsinfo}"
if [ "${upsinfo}" != "Error: Connection failure: Connection refused" ]; then
if [ "${upsinfo}" != "" ] && [ "${upsinfo}" != "Error: Connection failure: Connection refused" ]; then
OFFSITE_VOLTIN=$(echo "${upsinfo}" | grep 'input.voltage:' | sed 's/.*: //')
OFFSITE_BATT_RUNTIME=$(echo "${upsinfo}" | grep 'battery.runtime:' | sed 's/.*: //')
OFFSITE_BATT_RUNTIME=`echo "scale=2; ${OFFSITE_BATT_RUNTIME}/60" | bc`