This commit is contained in:
2023-12-11 15:50:37 -06:00
parent 552bd90054
commit 7b1d7a2f29

View File

@@ -8,7 +8,7 @@ source /opt/idssys/defaults/default.inc
source /opt/idssys/powerwall/defaults.inc source /opt/idssys/powerwall/defaults.inc
source ${PW_FOLDER}/settings.conf source ${PW_FOLDER}/settings.conf
# TEST=true TEST=true
shopt -s lastpipe shopt -s lastpipe
@@ -370,14 +370,14 @@ CHECKTEMP_SERVICE(){
Previous Temp: ${last_temp[${SENSOR}]}${GAUGESH}" Previous Temp: ${last_temp[${SENSOR}]}${GAUGESH}"
echo -e "($(date +'%Y-%m-%d %H:%M:%S')) - ${temp_f}${GAUGESH} - Back to NORMAL ${GAUGE} - Previous ${GAUGE}: ${last_temp[${SENSOR}]}${GAUGESH}" >> ${logtemp} echo -e "($(date +'%Y-%m-%d %H:%M:%S')) - ${temp_f}${GAUGESH} - Back to NORMAL ${GAUGE} - Previous ${GAUGE}: ${last_temp[${SENSOR}]}${GAUGESH}" >> ${logtemp}
echo -e "($(date +'%Y-%m-%d %H:%M:%S')) - ${temp_f}${GAUGESH} - ${SENSOR} - Back to NORMAL ${GAUGE}" >> ${PW_LOGFILE} echo -e "($(date +'%Y-%m-%d %H:%M:%S')) - ${temp_f}${GAUGESH} - ${SENSOR} - Back to NORMAL ${GAUGE}" >> ${PW_LOGFILE}
# [ "$(compgen -G "${PW_TMPFOLDER}/shutdown.*")" != "" ] && rm -f ${PW_TMPFOLDER}/shutdown.* # [ "$(compgen -G "${PW_TMPFOLDER}/power.*.off")" != "" ] && rm -f ${PW_TMPFOLDER}/power.*.off
elif [ "${last_temp[${SENSOR}]}" == "1" ]; then elif [ "${last_temp[${SENSOR}]}" == "1" ]; then
# SENDNOTICE "${SENSOR} TEMP NORMAL" "Service Startup # SENDNOTICE "${SENSOR} TEMP NORMAL" "Service Startup
# NORMAL TEMP: ${temp_f}${GAUGESH}" # NORMAL TEMP: ${temp_f}${GAUGESH}"
echo -e "($(date +'%Y-%m-%d %H:%M:%S')) - ${temp_f}${GAUGESH} - Service Startup - NORMAL ${GAUGE}" >> ${logtemp} echo -e "($(date +'%Y-%m-%d %H:%M:%S')) - ${temp_f}${GAUGESH} - Service Startup - NORMAL ${GAUGE}" >> ${logtemp}
echo -e "($(date +'%Y-%m-%d %H:%M:%S')) - ${temp_f}${GAUGESH} - ${SENSOR} - Service Startup" >> ${PW_LOGFILE} echo -e "($(date +'%Y-%m-%d %H:%M:%S')) - ${temp_f}${GAUGESH} - ${SENSOR} - Service Startup" >> ${PW_LOGFILE}
# [ "$(compgen -G "${PW_TMPFOLDER}/shutdown.*")" != "" ] && rm -f ${PW_TMPFOLDER}/shutdown.* # [ "$(compgen -G "${PW_TMPFOLDER}/power.*.off")" != "" ] && rm -f ${PW_TMPFOLDER}/power.*.off
elif [ "${relog}" == "1" ]; then elif [ "${relog}" == "1" ]; then
echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${temp_f}${GAUGESH} - Normal ${GAUGE}" >> ${logtemp} echo "($(date +'%Y-%m-%d %H:%M:%S')) - ${temp_f}${GAUGESH} - Normal ${GAUGE}" >> ${logtemp}
@@ -872,6 +872,10 @@ BATT VOLTAGE: ${BATTVOLT}'volts"
fi fi
fi fi
if [ ! -f ${PW_TMPFOLDER}/power.ac.good ]; then if [ ! -f ${PW_TMPFOLDER}/power.ac.good ]; then
if [ -f ${PW_TMPFOLDER}/power.sys.off ]
fi
rm -f ${PW_TMPFOLDER}/power.ac.* rm -f ${PW_TMPFOLDER}/power.ac.*
touch ${PW_TMPFOLDER}/power.ac.good touch ${PW_TMPFOLDER}/power.ac.good
fi fi
@@ -888,7 +892,7 @@ BATT VOLTAGE: ${BATTVOLT}'volts"
SENDNOTICE "POWER ALERT - POWER OFF/LOW!!" "Power off or low voltage detected SENDNOTICE "POWER ALERT - POWER OFF/LOW!!" "Power off or low voltage detected
VOLTAGE: ${INPUTACV}'volts VOLTAGE: ${INPUTACV}'volts
BATT VOLTAGE: ${BATTVOLT}'volts" 1 BATT VOLTAGE: ${BATTVOLT}'volts" 1
rm -f ${PW_TMPFOLDER}/power.ac.good rm -f ${PW_TMPFOLDER}/power.ac.good
touch ${PW_TMPFOLDER}/power.ac.low touch ${PW_TMPFOLDER}/power.ac.low
fi fi
if [ ! -f ${PW_TMPFOLDER}/power.ac.conserve ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/power.ac.low)) -ge 120 ]; then if [ ! -f ${PW_TMPFOLDER}/power.ac.conserve ] && [ $(expr `date +%s` - $(stat -c %Y ${PW_TMPFOLDER}/power.ac.low)) -ge 120 ]; then
@@ -1236,12 +1240,12 @@ SHUTDOWN_CRIT(){
fi fi
} }
SHUTDOWN_OFFSITE(){ SHUTDOWN_OFFSITE(){
if [ ! -f ${PW_TMPFOLDER}/shutdown.offsite ]; then if [ ! -f ${PW_TMPFOLDER}/power.offsite.off ]; then
SENDNOTICE "OFFSITE SHUTDOWN - POWER OFF/LOW!!" "Shutting down offsite host(s)" 1 SENDNOTICE "OFFSITE SHUTDOWN - POWER OFF/LOW!!" "Shutting down offsite host(s)" 1
for offsite_host in "${PW_OFFSITEHOSTS[@]}"; do for offsite_host in "${PW_OFFSITEHOSTS[@]}"; do
SHUTDOWN_SERVER ${offsite_host} & SHUTDOWN_SERVER ${offsite_host} &
done done
touch ${PW_TMPFOLDER}/shutdown.offsite touch ${PW_TMPFOLDER}/power.offsite.off
fi fi
} }
@@ -1661,8 +1665,8 @@ SHUTDOWN_SERVERS(){
fi fi
elif [ "${1^^}" == "OFFSITE" ]; then elif [ "${1^^}" == "OFFSITE" ]; then
if [ ! -f ${PW_TMPFOLDER}/shutdown.offsite ]; then if [ ! -f ${PW_TMPFOLDER}/power.offsite.off ]; then
touch ${PW_TMPFOLDER}/shutdown.offsite touch ${PW_TMPFOLDER}/power.offsite.off
if [ "${2}" != "maintenance" ]; then if [ "${2}" != "maintenance" ]; then
MSG="Disabling CLS in vCenter" MSG="Disabling CLS in vCenter"
@@ -1971,7 +1975,14 @@ HOSTMGMT(){
fi fi
elif [ "${MODE}" == "power" ]; then elif [ "${MODE}" == "power" ]; then
HOSTPOWER ${HOST} ${POWER} if [ "${HOST^^}" == "ALL" ] || [ "${HOST^^}" == "MAINSITE" ] || [ "${HOST^^}" == "OFFSITE" ] || [ "${HOST^^}" == "MAIN" ] || [ "${HOST^^}" == "SYS" ]; then
var=PW_${HOST^^}HOSTS[@]; v=1
for vhost in "${!var}"; do
HOSTPOWER ${vhost} ${POWER}
done
else
HOSTPOWER ${HOST} ${POWER}
fi
fi fi
echo echo
} }