This commit is contained in:
2024-11-10 21:28:16 -06:00
parent b33a252874
commit 1b1b9f3119
2 changed files with 24 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
VERS='2.8.1-11102024'
VERS='2.8.2-11102024'
noheader=' update service dailytemp confsync -r -report test '

View File

@@ -939,8 +939,13 @@ AMBIENT TEMP: ${OFFSITE_TEMP}'F"
fi
if [ -f ${PW_TMPFOLDER}/shutdown.OFFSITE ]; then
if [ -f ${PW_TMPFOLDER}/power.offsite.restored ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/power.offsite.restored)) -gt $(echo "scale=2; ${PW_OFFSITE_WAIT_TO_POWER_SERVERS}*60" | bc) ]; then
if [ "$(CHECK_HOST ${PW_IP})" != "false" ]; then
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${OFFSITE_VOLTIN}'volts - ${OFFSITE_BATT_CAP}'% Battery - Powering Hosts ON After Power Outage" >> ${PW_LOGFILE}
if [ -f ${PW_TMPFOLDER}/power.offsite.nohomeconn ]; then
SENDNOTICE2 "OFFSITE HOST POWER" "Powerwall connections has been established, powering offsite host(s) back ONLINE after power outage"
else
SENDNOTICE2 "OFFSITE HOST POWER" "Powering offsite host(s) back ONLINE after power outage"
fi
for host in ${PW_OFFSITEHOSTS_IDRAC}; do
if [ "${TEST}" = "" ] || [ "${TEST}" = "full" ]; then
ipmitool -I lanplus -H ${host} -U ${PW_ESXI_USER} -P "${PW_ESXI_PASS}" chassis power on &
@@ -948,8 +953,17 @@ AMBIENT TEMP: ${OFFSITE_TEMP}'F"
echo "TESTMODE: Powering up '${host}'"
fi
done
rm -f ${PW_TMPFOLDER}/power.offsite.restored
rm -f ${PW_TMPFOLDER}/shutdown.OFFSITE
rm -f ${PW_TMPFOLDER}/power.offsite.restored ${PW_TMPFOLDER}/power.offsite.nohomeconn ${PW_TMPFOLDER}/shutdown.OFFSITE
else
if [ ! -f ${PW_TMPFOLDER}/power.offsite.nohomeconn ]; then
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${OFFSITE_VOLTIN}'volts - ${OFFSITE_BATT_CAP}'% Battery - Will wait to power on offsite host(s) until powerwall connection is regained" >> ${PW_LOGFILE}
touch ${PW_TMPFOLDER}/power.offsite.nohomeconn
SENDNOTICE2 "OFFSITE HOST POWER" "Will wait to power on offsite host(s) until powerwall connection is regained"
elif [ -f ${PW_TMPFOLDER}/power.offsite.nohomeconn ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/power.offsite.nohomeconn)) -gt $(echo "scale=2; ${PW_OFFSITE_WAIT_TO_POWER_SERVERS}*60" | bc) ]; then
touch ${PW_TMPFOLDER}/power.offsite.nohomeconn
SENDNOTICE2 "OFFSITE HOST POWER" "Still waiting for connection to powerwall before powering offsite host(s) back on"
fi
fi
fi
fi
logtime=$(expr `date +%s` - $(stat -c %Y ${PW_LOGPOWER}))