From f18a98f563b79198ac4a2d83770629a0c37e424a Mon Sep 17 00:00:00 2001 From: poka Date: Fri, 26 Feb 2021 04:16:11 +0100 Subject: [PATCH] Make only 1 GVA request --- scripts/walletsBalance.sh | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/scripts/walletsBalance.sh b/scripts/walletsBalance.sh index a9f8b87..955d394 100755 --- a/scripts/walletsBalance.sh +++ b/scripts/walletsBalance.sh @@ -12,19 +12,28 @@ node=$(cut -d '/' -f3 <<<"$DUNITER") work() { for i in $wallets; do - exec() { - balance=$($JAKLIS balance -p $i 2>/dev/null) - } - exec - while [[ $? == 1 ]]; do echo "Erreur $k: $i"; ((k++)); exec; done - unset k if [[ $1 == "members" ]]; then - username=$($JAKLIS id -p $i | jq -r .username) + exec() { + jsonResult=$($JAKLIS idBalance -p $i 2>/dev/null) + } + exec + while [[ $? == 1 ]]; do echo "Erreur $k: $i"; ((k++)); exec; done + unset k + + balance=$(echo "$jsonResult" | jq -r '.balance') + username=$(echo "$jsonResult" | jq -r '.username') formatedBalance=$(printf "%-10s | %-45s | %-1s" $balance $i $username) htmlBloc="$htmlBloc"$'\n'"$balance$i$username" unset username else + exec() { + balance=$($JAKLIS id -p $i 2>/dev/null) + } + exec + while [[ $? == 1 ]]; do echo "Erreur $k: $i"; ((k++)); exec; done + unset k + formatedBalance=$(printf "%-10s | %-45s" $balance $i) htmlBloc="$htmlBloc"$'\n'"$balance$i " fi