Update temp.inc.sh

This commit is contained in:
2023-12-17 11:13:17 -06:00
parent 54b09b3e98
commit e6a70af6f1

View File

@@ -612,28 +612,28 @@ SERVERROOM_TEMP_DIFFERENCE(){
echo -en "${idsCL[Yellow]}Pulling data and calculating average scan times for the last '${LAST}' scans ... "
lastscantime=$(tail -n 1 ${PW_TMPFOLDER}/.log.sr.difference)
lastscantime=${lastscantime#*~}
scantimes=$(tail -n ${LAST} ${PW_TMPFOLDER}/.log.sr.difference)
longest_scantime=0
last_tempdiff=$(tail -n 1 ${PW_TMPFOLDER}/.log.sr.difference)
last_tempdiff=${last_tempdiff#*~}
tempdiffs=$(tail -n ${LAST} ${PW_TMPFOLDER}/.log.sr.difference)
longest_tempdiff=0
IFS=$'\n'
read -rd '' -a scantimes <<<"${scantimes}"
read -rd '' -a tempdiffs <<<"${tempdiffs}"
unset IFS
scantimes_total=0; scansfound=0
for scantime in "${scantimes[@]}"; do
[[ "${scantime}" = *"~"* ]] && scantime=${scantime#*~}
[ ${scantime} -gt ${longest_scantime} ] && longest_scantime=${scantime}
scantimes_total=$(bc <<< "scale=2; ${scantimes_total}+${scantime}")
tempdiff_total=0; scansfound=0
for tempdiff in "${tempdiffs[@]}"; do
[[ "${tempdiff}" = *"~"* ]] && tempdiff=${tempdiff#*~}
[ $(bc -l <<< "${tempdiff} >= ${longest_tempdiff}") -eq 1 ] && longest_tempdiff=${tempdiff}
tempdiff_total=$(bc <<< "scale=2; ${tempdiff_total}+${tempdiff}")
((scansfound++))
done
[ ${scansfound} -eq 0 ] && average=0 || average=$(ROUND_NUMBER $(bc <<< "scale=2; ${scantimes_total}/${scansfound}") 0)
[ ${scansfound} -eq 0 ] && average=0 || average=$(ROUND_NUMBER $(bc <<< "scale=2; ${tempdiff_total}/${scansfound}") 0)
average_disp=$(SHOW_TIME ${average} s)
c=0; spcT=''; spc1=`expr 25 - ${#average}`; until [ $c = ${spc1} ]; do spct="${spct} "; c=`expr $c + 1`; done
lastscantime_disp=$(SHOW_TIME ${lastscantime} s)
longest_scantime_disp=$(SHOW_TIME ${longest_scantime} s)
last_tempdiff_disp=$(SHOW_TIME ${last_tempdiff} s)
longest_tempdiff_disp=$(SHOW_TIME ${longest_tempdiff} s)
[ -f ${PW_TMPFOLDER}/.log.sr.difference ] && last_scancheck=$(date -d @$(stat -c %Y ${PW_TMPFOLDER}/.log.sr.difference) "+%Y-%m-%d %H:%M:%S") || last_scancheck=""
@@ -643,9 +643,9 @@ SERVERROOM_TEMP_DIFFERENCE(){
echo -e "${idsCL[Green]}Average for last `IDS_NUMBER_FORMAT ${scansfound}` ${idsCL[LightGreen]}(${average}s)${spct}${idsCL[Green]}${average_disp}${idsCL[Default]}"
DIVIDER . lightCyan 60
echo
echo -e "${idsCL[LightCyan]}Longest scan from above : ${idsCL[LightGreen]}(${longest_scantime}s) ${idsCL[Green]}${longest_scantime_disp}${idsCL[Default]}"
echo -e "${idsCL[LightCyan]}Longest scan from above : ${idsCL[LightGreen]}(${longest_tempdiff}s) ${idsCL[Green]}${longest_tempdiff_disp}${idsCL[Default]}"
echo
echo -e "${idsCL[LightCyan]}Last Scan Time : ${idsCL[LightGreen]}(${lastscantime}s) ${idsCL[Green]}${lastscantime_disp}${idsCL[Default]}"
echo -e "${idsCL[LightCyan]}Last Scan Time : ${idsCL[LightGreen]}(${last_tempdiff}s) ${idsCL[Green]}${last_tempdiff_disp}${idsCL[Default]}"
echo -e "${idsCL[LightCyan]}Last Scan Check : ${idsCL[LightGreen]}${last_scancheck}${idsCL[Default]}"
if [ ${scansfound} -le 500 ]; then
@@ -654,19 +654,19 @@ SERVERROOM_TEMP_DIFFERENCE(){
if [ "${choice^^}" == "Y" ]; then
echo -en "\r\033[K"
lastscansnum=${scansfound}
last_scantimes=$(tail -n ${lastscansnum} ${NM_LOGFOLDER}/status-check.scantimes)
last_tempdiffs=$(tail -n ${lastscansnum} ${PW_TMPFOLDER}/.log.sr.difference)
IFS=$'\n'
read -rd '' -a last_scantimes <<<"${last_scantimes}"
read -rd '' -a last_tempdiffs <<<"${last_tempdiffs}"
unset IFS
echo -e "${idsCL[LightCyan]}Last ${lastscansnum} Scan Times\n${idsCL[Green]}------------------------------------------${idsCL[Default]}"
for scantime in "${last_scantimes[@]}"; do
if [[ "${scantime}" = *"~"* ]]; then
dt="${scantime%~*}"
scantime=${scantime#*~}
for tempdiff in "${last_tempdiffs[@]}"; do
if [[ "${tempdiff}" = *"~"* ]]; then
dt="${tempdiff%~*}"
tempdiff=${tempdiff#*~}
else
dt=" "
fi
echo -e "${idsCL[White]} ${dt} (${scantime}s) ${idsCL[Yellow]}$(SHOW_TIME ${scantime} s)${idsCL[Default]}"
echo -e "${idsCL[White]} ${dt} (${tempdiff}s) ${idsCL[Yellow]}$(SHOW_TIME ${tempdiff} s)${idsCL[Default]}"
done
fi
fi