Update offsite-power-check.sh

This commit is contained in:
2023-11-05 21:50:20 -06:00
parent 652dfa2015
commit 7ee9c07e64

View File

@@ -15,8 +15,8 @@ WAIT_TO_POWER_SERVERS=5 #minutes
LOG_INTERVAL_NORMAL=60 #minutes
LOG_INTERVAL_ABNORMAL=5 #minutes
TEST=true
if [ "$TEST" = "true" ]; then
TEST=true #full
if [ "$TEST" != "" ]; then
SHUTDOWNSERVERS_AT_LOAD=95 #percent
WAIT_TO_POWER_SERVERS=1 #minutes
LOG_INTERVAL_NORMAL=1 #minutes
@@ -75,7 +75,7 @@ AC VOLTAGE: ${OFFSITE_VOLTIN}'Volts"
BATTERY CHARGE: ${OFFSITE_BATT_CAP}'(percent)
BATT RUNTIME: ${OFFSITE_BATT_RUNTIME}'Mins
AC VOLTAGE: ${OFFSITE_VOLTIN}'Volts"
[ "$TEST" != "true" ] && ipmitool -I lanplus -H 10.2.1.21 -U ${PW_ESXI_USER} -P "${PW_ESXI_PASS}" chassis power on &
([ "$TEST" = "" ] || [ "$TEST" = "full" ]) && ipmitool -I lanplus -H 10.2.1.21 -U ${PW_ESXI_USER} -P "${PW_ESXI_PASS}" chassis power on &
rm -f ${PW_TMPFOLDER}/power.offsite.*
fi
fi
@@ -102,7 +102,7 @@ BATTERY CHARGE: ${OFFSITE_BATT_CAP}'(percent)
BATT RUNTIME: ${OFFSITE_BATT_RUNTIME}'Mins
AC VOLTAGE: ${OFFSITE_VOLTIN}'Volts" 1
touch ${PW_TMPFOLDER}/power.offsite.off
[ "$TEST" != "true" ] && ssh root@10.2.1.11 /vmfs/volumes/652c94ef-ee49895b-365d-00109b3fea40/.SCRIPTS/esxi-shutdown2.sh &
([ "$TEST" = "" ] || [ "$TEST" = "full" ]) && ssh root@10.2.1.11 /vmfs/volumes/652c94ef-ee49895b-365d-00109b3fea40/.SCRIPTS/esxi-shutdown2.sh &
fi
[ $(expr `date +%s` - $(stat -f %m ${PW_LOGPOWER})) -gt $(echo "scale=2; ${LOG_INTERVAL_ABNORMAL}*60" | bc) ] && echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${OFFSITE_VOLTIN}'Volts - ${OFFSITE_BATT_CAP}% Battery - OFF/LOW POWER!!" >> ${PW_LOGPOWER}
fi