Update temp.inc.sh
This commit is contained in:
@@ -612,28 +612,28 @@ SERVERROOM_TEMP_DIFFERENCE(){
|
|||||||
|
|
||||||
echo -en "${idsCL[Yellow]}Pulling data and calculating average scan times for the last '${LAST}' scans ... "
|
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)
|
last_tempdiff=$(tail -n 1 ${PW_TMPFOLDER}/.log.sr.difference)
|
||||||
lastscantime=${lastscantime#*~}
|
last_tempdiff=${last_tempdiff#*~}
|
||||||
scantimes=$(tail -n ${LAST} ${PW_TMPFOLDER}/.log.sr.difference)
|
tempdiffs=$(tail -n ${LAST} ${PW_TMPFOLDER}/.log.sr.difference)
|
||||||
longest_scantime=0
|
longest_tempdiff=0
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
read -rd '' -a scantimes <<<"${scantimes}"
|
read -rd '' -a tempdiffs <<<"${tempdiffs}"
|
||||||
unset IFS
|
unset IFS
|
||||||
scantimes_total=0; scansfound=0
|
tempdiff_total=0; scansfound=0
|
||||||
for scantime in "${scantimes[@]}"; do
|
for tempdiff in "${tempdiffs[@]}"; do
|
||||||
[[ "${scantime}" = *"~"* ]] && scantime=${scantime#*~}
|
[[ "${tempdiff}" = *"~"* ]] && tempdiff=${tempdiff#*~}
|
||||||
[ ${scantime} -gt ${longest_scantime} ] && longest_scantime=${scantime}
|
[ $(bc -l <<< "${tempdiff} >= ${longest_tempdiff}") -eq 1 ] && longest_tempdiff=${tempdiff}
|
||||||
scantimes_total=$(bc <<< "scale=2; ${scantimes_total}+${scantime}")
|
tempdiff_total=$(bc <<< "scale=2; ${tempdiff_total}+${tempdiff}")
|
||||||
((scansfound++))
|
((scansfound++))
|
||||||
done
|
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)
|
average_disp=$(SHOW_TIME ${average} s)
|
||||||
c=0; spcT=''; spc1=`expr 25 - ${#average}`; until [ $c = ${spc1} ]; do spct="${spct} "; c=`expr $c + 1`; done
|
c=0; spcT=''; spc1=`expr 25 - ${#average}`; until [ $c = ${spc1} ]; do spct="${spct} "; c=`expr $c + 1`; done
|
||||||
|
|
||||||
lastscantime_disp=$(SHOW_TIME ${lastscantime} s)
|
last_tempdiff_disp=$(SHOW_TIME ${last_tempdiff} s)
|
||||||
longest_scantime_disp=$(SHOW_TIME ${longest_scantime} 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=""
|
[ -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]}"
|
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
|
DIVIDER . lightCyan 60
|
||||||
echo
|
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
|
||||||
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]}"
|
echo -e "${idsCL[LightCyan]}Last Scan Check : ${idsCL[LightGreen]}${last_scancheck}${idsCL[Default]}"
|
||||||
|
|
||||||
if [ ${scansfound} -le 500 ]; then
|
if [ ${scansfound} -le 500 ]; then
|
||||||
@@ -654,19 +654,19 @@ SERVERROOM_TEMP_DIFFERENCE(){
|
|||||||
if [ "${choice^^}" == "Y" ]; then
|
if [ "${choice^^}" == "Y" ]; then
|
||||||
echo -en "\r\033[K"
|
echo -en "\r\033[K"
|
||||||
lastscansnum=${scansfound}
|
lastscansnum=${scansfound}
|
||||||
last_scantimes=$(tail -n ${lastscansnum} ${NM_LOGFOLDER}/status-check.scantimes)
|
last_tempdiffs=$(tail -n ${lastscansnum} ${PW_TMPFOLDER}/.log.sr.difference)
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
read -rd '' -a last_scantimes <<<"${last_scantimes}"
|
read -rd '' -a last_tempdiffs <<<"${last_tempdiffs}"
|
||||||
unset IFS
|
unset IFS
|
||||||
echo -e "${idsCL[LightCyan]}Last ${lastscansnum} Scan Times\n${idsCL[Green]}------------------------------------------${idsCL[Default]}"
|
echo -e "${idsCL[LightCyan]}Last ${lastscansnum} Scan Times\n${idsCL[Green]}------------------------------------------${idsCL[Default]}"
|
||||||
for scantime in "${last_scantimes[@]}"; do
|
for tempdiff in "${last_tempdiffs[@]}"; do
|
||||||
if [[ "${scantime}" = *"~"* ]]; then
|
if [[ "${tempdiff}" = *"~"* ]]; then
|
||||||
dt="${scantime%~*}"
|
dt="${tempdiff%~*}"
|
||||||
scantime=${scantime#*~}
|
tempdiff=${tempdiff#*~}
|
||||||
else
|
else
|
||||||
dt=" "
|
dt=" "
|
||||||
fi
|
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
|
done
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user