From b67de6d2d18bb0974067a88210455f68dd4e2218 Mon Sep 17 00:00:00 2001 From: poka Date: Mon, 21 Sep 2020 04:57:13 +0200 Subject: [PATCH] Cosmetic --- g1-stats.sh | 11 +++++++---- lib/scanTxWallets.sh | 3 +-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/g1-stats.sh b/g1-stats.sh index 36e6e3d..727ce9f 100755 --- a/g1-stats.sh +++ b/g1-stats.sh @@ -7,9 +7,10 @@ # Git: https://git.p2p.legal/axiom-team/g1-stats ################################################################################ -# Stop if error +# Exit script if error set -e +# Récupération du chemin absolut du répertoir du script actuel SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" if [[ -e $SCRIPTPATH/.env ]]; then source $SCRIPTPATH/.env; else echo "Veuillez créer votre fichier .env inspiré de .env.example" && exit 1; fi @@ -19,17 +20,20 @@ day=$(date +'%y-%m-%d') dayP=$(date +'%d-%m-%y') indexhtml="$WEBPATH/index.html" echo -e "\n############# $day à $startTime #############\n" -[[ -z $(which jq) || -z $(which bc) ]] && apt update && apt install jq bc +[[ -z $(which jq) || -z $(which bc) || -z $(which curl) ]] && sudo apt update && sudo apt install jq bc curl echo "Initialisation ..." #TXBLOCKS=$(cat $SCRIPTPATH/db/txblocs) #kopa TXBLOCKS=$(curl -s ${DUNITER}/blockchain/with/tx | jq '.result.blocks[]') TXBLOCKS=($(echo "$TXBLOCKS" | sort -hu | awk '{printf $1" "}')) unset 'TXBLOCKS[${#TXBLOCKS[@]}-1]' +echo "TXBLOCKS OK" membresPubkeys=$(curl -s ${DUNITER}/wot/members | jq -r '.results[].pubkey') #membresPubkeys=$(cat db/membresPubkeys) #kopa +echo "membresPubkeys OK" nbrMembers=$(echo "$membresPubkeys" | wc -l) lastBloc=${TXBLOCKS[-1]} udBlocs=$(curl -s ${DUNITER}/blockchain/with/ud | jq '.result.blocks[]') +echo "udBlocs OK" isWeb=$1 jsonFile="$SCRIPTPATH/db/daily.json" @@ -38,7 +42,7 @@ source $SCRIPTPATH/lib/functions.sh source $SCRIPTPATH/lib/scanTxWallets.sh ### Extraction des adresses Ḡ1 actives -scanTxWallets $1 #kopa +scanTxWallets #kopa ### Calcul la somme des soldes portefeuilles et membres sumSoldes @@ -53,7 +57,6 @@ nbrWallets displayStats ### Renseignement de l'index web et indexation de l'historique -# source $SCRIPTPATH/lib/functions.sh # On source les fonctions de nouveau [[ $isWeb == "web" ]] && web ### Fin de programme diff --git a/lib/scanTxWallets.sh b/lib/scanTxWallets.sh index aeb0cd2..4041442 100755 --- a/lib/scanTxWallets.sh +++ b/lib/scanTxWallets.sh @@ -191,7 +191,7 @@ scanTxWallets() { echo "Scan des blocs avec transactions en cours ..." fi -# [[ $i -ge $1 ]] && break #kopa +# [[ $i -ge 10 ]] && break #kopa done [[ $blockDateLast == $blockDate ]] && applyToday @@ -206,4 +206,3 @@ scanTxWallets() { [[ ! -d $SCRIPTPATH/cache ]] && mkdir $SCRIPTPATH/cache echo -e "$lastBloc\n$wallets\n---\n$walletsAuj\n---\n$nbrMembersYesterday|$blockDateLast" > $SCRIPTPATH/cache/walletsUp-$i } -