From d69b60e362f886c1f0547322f659c72248b3e112 Mon Sep 17 00:00:00 2001 From: poka Date: Thu, 24 Sep 2020 02:25:27 +0200 Subject: [PATCH] Improve cleaning text for progress view --- g1-stats.sh | 3 +++ lib/scanTxWallets.sh | 14 ++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/g1-stats.sh b/g1-stats.sh index 20c4aef..c97fa32 100755 --- a/g1-stats.sh +++ b/g1-stats.sh @@ -26,12 +26,15 @@ if $debug; then TXBLOCKS=$(cat $SCRIPTPATH/db/debug/txblocs) membresPubkeys=$(cat $SCRIPTPATH/db/debug/membresPubkeys) udBlocs=$(cat $SCRIPTPATH/db/debug/udblocs) + echo # To clean next progress view else TXBLOCKS=$(curl -s ${DUNITER}/blockchain/with/tx | jq '.result.blocks[]') echo "TXBLOCKS OK" membresPubkeys=$(curl -s ${DUNITER}/wot/members | jq -r '.results[].pubkey') + tput cuu1;tput el; echo "membresPubkeys OK" udBlocs=$(curl -s ${DUNITER}/blockchain/with/ud | jq '.result.blocks[]') + tput cuu1;tput el; echo "udBlocs OK" fi diff --git a/lib/scanTxWallets.sh b/lib/scanTxWallets.sh index 78ef24e..cd53e2f 100755 --- a/lib/scanTxWallets.sh +++ b/lib/scanTxWallets.sh @@ -27,7 +27,6 @@ scanTxWallets() { bloc=${TXBLOCKS[$i]} [[ -z $bloc ]] && break # [[ $i -lt 290 ]] && continue #kopa - sleep 0.05 # Récupère la date et l'objet transaction du bloc courant blocFull=$(curl -s ${DUNITER}/blockchain/block/$bloc) @@ -203,14 +202,13 @@ scanTxWallets() { midTimeExec=$(echo "scale=3; $midTimeExecCum/$incExec" | bc) ((incExec++)) if [[ $isWeb != "web" ]]; then - clear - echo "Heure de début: $startTime" - echo - echo "Scan en cours: $progress% - $bloc/$lastBloc (Boucle $i)" - echo "Date: $blockDate" - echo "Temps d'execution: $midTimeExec" + tput cuu1;tput el;tput cuu1;tput el;tput cuu1;tput el;tput cuu1;tput el;tput cuu1;tput el; # Clear the last view + echo -e "Heure de début: $startTime\n + \rScan en cours: $progress% - $bloc/$lastBloc (Boucle $i) + \rDate: $blockDate + \rTemps d'execution: $midTimeExec" else - echo "Scan des blocs avec transactions en cours ..." + [[ -z $firstScan ]] && echo "Scan des blocs avec transactions en cours ..." && firstScan=true fi # [[ $i -ge 35949 ]] && break #kopa done