From b3f642d9341df9cdf19807f915167c70eab4464e Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Sat, 16 Dec 2023 20:16:47 -0600 Subject: [PATCH] Update status.inc --- inc/status.inc | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/inc/status.inc b/inc/status.inc index bf8e9a3b..308584a2 100755 --- a/inc/status.inc +++ b/inc/status.inc @@ -822,16 +822,26 @@ STATUS_SCANTIMES(){ IFS=$'\n' read -rd '' -a scantimes <<<"${scantimes}" unset IFS - scantimes_total=0; scansfound=0 + scantimes_total_norm=0; scansfound_norm=0 + scantimes_total_repl=0; scansfound_repl=0 + scantimes_total_xtr=0; scansfound_xtr=0 for scantime in "${scantimes[@]}"; do [[ "${scantime}" = *"~"* ]] && scantime=${scantime#*~} - scantimes_total=$(bc <<< "scale=2; ${scantimes_total}+${scantime}") - ((scansfound++)) + if [ ${scantime} -le 35 ]; then + scantimes_total_norm=$(bc <<< "scale=2; ${scantimes_total_norm}+${scantime}") + ((scansfound_norm++)) + elif [ ${scantime} -le 60 ]; then + scantimes_total_repl=$(bc <<< "scale=2; ${scantimes_total_repl}+${scantime}") + ((scansfound_repl++)) + else + scantimes_total_xtr=$(bc <<< "scale=2; ${scantimes_total_xtr}+${scantime}") + ((scansfound_xtr++)) + fi done - average=$(ROUND_NUMBER $(bc <<< "scale=2; ${scantimes_total}/${scansfound}") 0) + average_norm=$(ROUND_NUMBER $(bc <<< "scale=2; ${scantimes_total_norm}/${scansfound_norm}") 0) cw=8 - average_disp=$(SHOW_TIME ${average} s); c=0; spca=''; spc1=`expr ${cw} - ${#average_disp}` + average_norm_disp=$(SHOW_TIME ${average_norm} s); c=0; spca=''; spc1=`expr ${cw} - ${#average_norm_disp}` until [ $c = ${spc1} ]; do spca="${spca} "; c=`expr $c + 1`; done lastscantime_disp=$(SHOW_TIME ${lastscantime#*~} s); c=0; spcb=''; spc1=`expr ${cw} - ${#lastscantime_disp}` until [ $c = ${spc1} ]; do spcb="${spcb} "; c=`expr $c + 1`; done @@ -841,17 +851,17 @@ STATUS_SCANTIMES(){ echo -en "\r\033[K" - echo -e "${idsCL[LightCyan]}Average for last '${scansfound}' : ${idsCL[LightGreen]}(${average}s)${spca}${idsCL[Green]}${average_disp}${idsCL[Default]}\n" + echo -e "${idsCL[LightCyan]}Average for last '${scansfound_norm}' : ${idsCL[LightGreen]}(${average_norm}s)${spca}${idsCL[Green]}${average_norm_disp}${idsCL[Default]}\n" echo -e "${idsCL[LightCyan]}Last Scan Time : ${idsCL[LightGreen]}(${lastscantime#*~}s)${spcb}${idsCL[Green]}${lastscantime_disp}${idsCL[Default]}\n" echo -e "${idsCL[LightCyan]}Last Scan Check : ${idsCL[LightGreen]}${last_scancheck}${idsCL[Default]}\n" echo -e "${idsCL[LightCyan]}Last Replication Check : ${idsCL[LightGreen]}${last_replcheck}${idsCL[Default]}\n" - if [ ${scansfound} -le 500 ]; then - echo -en "${idsCL[LightCyan]}List out these '${scansfound}' scan times? (y/N): ${idsCL[Default]}" + if [ ${scansfound_norm} -le 500 ]; then + echo -en "${idsCL[LightCyan]}List out these '${scansfound_norm}' scan times? (y/N): ${idsCL[Default]}" read -n1 choice if [ "${choice^^}" == "Y" ]; then echo -en "\r\033[K" - lastscansnum=${scansfound} + lastscansnum=${scansfound_norm} last_scantimes=$(tail -n ${lastscansnum} ${NM_LOGFOLDER}/status-check.scantimes) IFS=$'\n' read -rd '' -a last_scantimes <<<"${last_scantimes}"