Add web generator

This commit is contained in:
poka 2019-10-29 05:18:10 +01:00
parent d98fd99695
commit 58945570b8
2 changed files with 21 additions and 0 deletions

View File

@ -2,6 +2,7 @@
### Variable ###
DUNITER="https://duniter-g1.p2p.legal"
indexhtml="index.html"
###
echo "Initialisation ..."
@ -59,6 +60,19 @@ nbrSimpleWallets=$(echo "$nbrTotalWallets-$nbrMembers" | bc)
pourcentMbrs=$(echo "scale=1; $nbrMembers*100/$nbrTotalWallets/1" | bc)
pourcentWallets=$(echo "scale=1; $nbrSimpleWallets*100/$nbrTotalWallets/1" | bc)
web() {
cp stats.html $indexhtml
sed -i "s/_nbrTotalWallets/$nbrTotalWallets/g" $indexhtml
sed -i "s/_nbrSimpleWallets/$nbrSimpleWallets/g" $indexhtml
sed -i "s/_nbrMembers/$nbrMembers/g" $indexhtml
sed -i "s/_pourcentMbrs/$pourcentMbrs/g" $indexhtml
sed -i "s/_pourcentWallets/$pourcentWallets/g" $indexhtml
chown www-data:www-data $indexhtml 2>/dev/null
}
[[ $1 == "web" ]] && web
echo -e "\n ---"
echo "Nombre total de wallet: $nbrTotalWallets"
echo "Nombre de membres: $nbrMembers (${pourcentMbrs}%)"

7
stats.html Normal file
View File

@ -0,0 +1,7 @@
<html>
Nombre total de wallet: _nbrTotalWallets
Nombre de membres: _nbrMembers _pourcentMbrs%
Nombre de simple portefeuille: _nbrSimpleWallets _pourcentWallets%
</html>