Update offsite-power-check.sh

This commit is contained in:
2023-12-10 14:38:55 -06:00
parent c5333405a9
commit 0cfb0d37d5

View File

@@ -57,7 +57,9 @@ PWO_START(){
BATTERY CHARGE: ${OFFSITE_BATT_CAP}'%25
BATT RUNTIME: ${OFFSITE_BATT_RUNTIME}'mins
AC VOLTAGE: ${OFFSITE_VOLTIN}'volts"
AC VOLTAGE: ${OFFSITE_VOLTIN}'volts
$(date +%Y-%m-%d-%H-%M-%S)"
if [ "${3}" = "1" ]; then PRIORITY="${3}"; MSGSOUND=siren; elif [ "${3}" != "" ]; then PRIORITY=${3}; else PRIORITY=0; fi
curl -sd "token=${PUSHOVER_APP_TOKEN}&user=${PUSHOVER_USER_TOKEN}&message=${MESSAGE}&title=${1}&priority=${PRIORITY}&sound=cosmic" https://api.pushover.net/1/messages.json >/dev/null 2>&1
}
@@ -108,7 +110,7 @@ AC VOLTAGE: ${OFFSITE_VOLTIN}'volts"
else
[ ! -f ${PW_TMPFOLDER}/power.offsite.ac.low ] && touch ${PW_TMPFOLDER}/power.offsite.ac.low
if [ ! -f ${PW_TMPFOLDER}/power.offsite.ac.low.notice ] || [ $(expr `date +%s` - $(stat -f %m ${PW_TMPFOLDER}/power.offsite.ac.low.notice)) -gt ${RENOTIFY_LOWPOWER} ]; then
if [ ! -f ${PW_TMPFOLDER}/power.offsite.ac.low.notice ] || [ $(expr `date +%s` - $(stat -f %m ${PW_TMPFOLDER}/power.offsite.ac.low.notice)) -gt $(echo "scale=2; ${RENOTIFY_LOWPOWER}*60" | bc) ]; then
# echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${OFFSITE_VOLTIN}'volts - ${OFFSITE_BATT_CAP}'% Battery - Powering LOW/OFF!" >> ${PW_LOGFILE}
SENDNOTICE "OFFSITE POWER - POWER OFF/LOW!!" "Power off or low voltage detected" 1
touch ${PW_TMPFOLDER}/power.offsite.ac.low.notice