Cosmetic
This commit is contained in:
parent
56525b7785
commit
b67de6d2d1
11
g1-stats.sh
11
g1-stats.sh
|
@ -7,9 +7,10 @@
|
||||||
# Git: https://git.p2p.legal/axiom-team/g1-stats
|
# Git: https://git.p2p.legal/axiom-team/g1-stats
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
# Stop if error
|
# Exit script if error
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Récupération du chemin absolut du répertoir du script actuel
|
||||||
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
|
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
|
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')
|
dayP=$(date +'%d-%m-%y')
|
||||||
indexhtml="$WEBPATH/index.html"
|
indexhtml="$WEBPATH/index.html"
|
||||||
echo -e "\n############# $day à $startTime #############\n"
|
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 ..."
|
echo "Initialisation ..."
|
||||||
#TXBLOCKS=$(cat $SCRIPTPATH/db/txblocs) #kopa
|
#TXBLOCKS=$(cat $SCRIPTPATH/db/txblocs) #kopa
|
||||||
TXBLOCKS=$(curl -s ${DUNITER}/blockchain/with/tx | jq '.result.blocks[]')
|
TXBLOCKS=$(curl -s ${DUNITER}/blockchain/with/tx | jq '.result.blocks[]')
|
||||||
TXBLOCKS=($(echo "$TXBLOCKS" | sort -hu | awk '{printf $1" "}'))
|
TXBLOCKS=($(echo "$TXBLOCKS" | sort -hu | awk '{printf $1" "}'))
|
||||||
unset 'TXBLOCKS[${#TXBLOCKS[@]}-1]'
|
unset 'TXBLOCKS[${#TXBLOCKS[@]}-1]'
|
||||||
|
echo "TXBLOCKS OK"
|
||||||
membresPubkeys=$(curl -s ${DUNITER}/wot/members | jq -r '.results[].pubkey')
|
membresPubkeys=$(curl -s ${DUNITER}/wot/members | jq -r '.results[].pubkey')
|
||||||
#membresPubkeys=$(cat db/membresPubkeys) #kopa
|
#membresPubkeys=$(cat db/membresPubkeys) #kopa
|
||||||
|
echo "membresPubkeys OK"
|
||||||
nbrMembers=$(echo "$membresPubkeys" | wc -l)
|
nbrMembers=$(echo "$membresPubkeys" | wc -l)
|
||||||
lastBloc=${TXBLOCKS[-1]}
|
lastBloc=${TXBLOCKS[-1]}
|
||||||
udBlocs=$(curl -s ${DUNITER}/blockchain/with/ud | jq '.result.blocks[]')
|
udBlocs=$(curl -s ${DUNITER}/blockchain/with/ud | jq '.result.blocks[]')
|
||||||
|
echo "udBlocs OK"
|
||||||
isWeb=$1
|
isWeb=$1
|
||||||
jsonFile="$SCRIPTPATH/db/daily.json"
|
jsonFile="$SCRIPTPATH/db/daily.json"
|
||||||
|
|
||||||
|
@ -38,7 +42,7 @@ source $SCRIPTPATH/lib/functions.sh
|
||||||
source $SCRIPTPATH/lib/scanTxWallets.sh
|
source $SCRIPTPATH/lib/scanTxWallets.sh
|
||||||
|
|
||||||
### Extraction des adresses Ḡ1 actives
|
### Extraction des adresses Ḡ1 actives
|
||||||
scanTxWallets $1 #kopa
|
scanTxWallets #kopa
|
||||||
|
|
||||||
### Calcul la somme des soldes portefeuilles et membres
|
### Calcul la somme des soldes portefeuilles et membres
|
||||||
sumSoldes
|
sumSoldes
|
||||||
|
@ -53,7 +57,6 @@ nbrWallets
|
||||||
displayStats
|
displayStats
|
||||||
|
|
||||||
### Renseignement de l'index web et indexation de l'historique
|
### Renseignement de l'index web et indexation de l'historique
|
||||||
# source $SCRIPTPATH/lib/functions.sh # On source les fonctions de nouveau
|
|
||||||
[[ $isWeb == "web" ]] && web
|
[[ $isWeb == "web" ]] && web
|
||||||
|
|
||||||
### Fin de programme
|
### Fin de programme
|
||||||
|
|
|
@ -191,7 +191,7 @@ scanTxWallets() {
|
||||||
echo "Scan des blocs avec transactions en cours ..."
|
echo "Scan des blocs avec transactions en cours ..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# [[ $i -ge $1 ]] && break #kopa
|
# [[ $i -ge 10 ]] && break #kopa
|
||||||
done
|
done
|
||||||
|
|
||||||
[[ $blockDateLast == $blockDate ]] && applyToday
|
[[ $blockDateLast == $blockDate ]] && applyToday
|
||||||
|
@ -206,4 +206,3 @@ scanTxWallets() {
|
||||||
[[ ! -d $SCRIPTPATH/cache ]] && mkdir $SCRIPTPATH/cache
|
[[ ! -d $SCRIPTPATH/cache ]] && mkdir $SCRIPTPATH/cache
|
||||||
echo -e "$lastBloc\n$wallets\n---\n$walletsAuj\n---\n$nbrMembersYesterday|$blockDateLast" > $SCRIPTPATH/cache/walletsUp-$i
|
echo -e "$lastBloc\n$wallets\n---\n$walletsAuj\n---\n$nbrMembersYesterday|$blockDateLast" > $SCRIPTPATH/cache/walletsUp-$i
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue