Update offsite-power-check.sh

This commit is contained in:
2023-11-05 14:25:08 -06:00
parent be22acfcf4
commit 78686984c3

View File

@@ -42,7 +42,7 @@ VOLTAGE: ${OFFSITE_VOLTIN}'Volts"
if [ ! -f ${PW_TMPFOLDER}/power.offsite.restored ]; then
touch ${PW_TMPFOLDER}/power.offsite.restored
elif [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/power.offsite.restored)) -ge 60 ]; then
elif [ $(expr `date +%s` - $(stat -f %Y ${PW_TMPFOLDER}/power.offsite.restored)) -ge 60 ]; then
SENDNOTICE2 "OFFSITE HOST POWER" "Powering offsite host(s) back on after power was restored"
for offsite_host in "${PW_OFFSITEHOSTS[@]}"; do
# HOSTPOWER ${offsite_host} on >/dev/null 2>&1
@@ -51,13 +51,13 @@ VOLTAGE: ${OFFSITE_VOLTIN}'Volts"
fi
else
[ $(expr `date +%s` - $(stat -c %Y ${PW_LOGPOWER})) -le 300 ] && echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${OFFSITE_VOLTIN}'Volts - Offsite Normal Voltage" >> ${PW_LOGPOWER}
[ $(expr `date +%s` - $(stat -f %Y ${PW_LOGPOWER})) -le 300 ] && echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${OFFSITE_VOLTIN}'Volts - Offsite Normal Voltage" >> ${PW_LOGPOWER}
fi
else
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${OFFSITE_VOLTIN}'Volts - OFFSITE POWER OFF/LOW POWER" >> ${PW_LOGPOWER}
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${OFFSITE_VOLTIN}'Volts - OFFSITE POWER OFF/LOW POWER" >> ${PW_LOGFILE}
if [ ! -f ${PW_TMPFOLDER}/power.offsite.ac.low ] || [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/power.offsite.ac.low)) -ge 240 ]; then
if [ ! -f ${PW_TMPFOLDER}/power.offsite.ac.low ] || [ $(expr `date +%s` - $(stat -f %Y ${PW_TMPFOLDER}/power.offsite.ac.low)) -ge 240 ]; then
SENDNOTICE2 "OFFSITE POWER ALERT - POWER OFF/LOW!!" "Power off or low voltage detected
BATT CAPACITY: ${OFFSITE_BATT_CAP}'(percent)
BATT RUNTIME: ${OFFSITE_BATT_RUNTIME}'Mins" 1