Update offsite-power-check.sh
This commit is contained in:
@@ -13,7 +13,7 @@ PW_TMPFOLDER=${PW_FOLDER}/.tmp
|
||||
SHUTDOWNSERVERS_AT_LOAD=80 #percent
|
||||
WAIT_TO_POWER_SERVERS=5 #minutes
|
||||
LOG_INTERVAL_NORMAL=60 #minutes
|
||||
LOG_INTERVAL_ABNORMAL=5 #minutes
|
||||
LOG_INTERVAL_ABNORMAL=30 #seconds
|
||||
|
||||
# TEST=true #full
|
||||
if [ "$TEST" != "" ]; then
|
||||
@@ -75,7 +75,7 @@ PWO_START(){
|
||||
fi
|
||||
fi
|
||||
logtime=$(expr `date +%s` - $(stat -f %m ${PW_LOGPOWER}))
|
||||
if [ ${logtime} -gt $(echo "scale=2; ${LOG_INTERVAL_NORMAL}*60" | bc) ] || ([ ${OFFSITE_BATT_CAP%.*} -lt 100 ] && [ ${logtime} -gt $(echo "scale=2; ${LOG_INTERVAL_ABNORMAL}*60" | bc) ]); then
|
||||
if [ ${logtime} -gt $(echo "scale=2; ${LOG_INTERVAL_NORMAL}*60" | bc) ] || ([ ${OFFSITE_BATT_CAP%.*} -lt 100 ] && [ ${logtime} -gt $(echo "scale=2; ${LOG_INTERVAL_ABNORMAL}" | bc) ]); then
|
||||
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${OFFSITE_VOLTIN}'Volts - ${OFFSITE_BATT_CAP}% Battery - Normal" >> ${PW_LOGPOWER}
|
||||
fi
|
||||
else
|
||||
@@ -91,7 +91,7 @@ PWO_START(){
|
||||
touch ${PW_TMPFOLDER}/power.offsite.off
|
||||
([ "$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}
|
||||
[ $(expr `date +%s` - $(stat -f %m ${PW_LOGPOWER})) -gt $(echo "scale=2; ${LOG_INTERVAL_ABNORMAL}" | bc) ] && echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${OFFSITE_VOLTIN}'Volts - ${OFFSITE_BATT_CAP}% Battery - OFF/LOW POWER!!" >> ${PW_LOGPOWER}
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user