From 0cfb0d37d5bf3fbccd3d7e51ab4b0f43fb2c1088 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sun, 10 Dec 2023 14:38:55 -0600 Subject: [PATCH] Update offsite-power-check.sh --- offsite-power-check.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/offsite-power-check.sh b/offsite-power-check.sh index bd600afa..732adb87 100755 --- a/offsite-power-check.sh +++ b/offsite-power-check.sh @@ -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