Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- bitcoindSynced() {
- #blockCount=`bitcoin-cli getblockcount`
- blockCount=`bitcoin-cli getblockcount`
- blockChain=`wget -O - http://blockchain.info/q/getblockcount`
- if [ -z $blockChain ] ; then
- echo "Error getting blockcount from http://blockchain.info/"
- exit 1
- fi
- let "blockDiff = expr $blockChain - $blockCount"
- printf "Number of blocks $blockCount\n"
- if [ $blockDiff = 0 ] ; then
- echo "up to date"
- else
- echo "$blockDiff blocks behind"
- fi
- perc=$(echo "$blockCount" / "$blockChain" | bc -l)
- perc=$(echo "$perc"*"100" | bc)
- perc=$(echo "$perc" | cut -c-5)
- printf ""$perc" %% Done \n"
- } 2>/dev/null
- bitcoindSynced
Add Comment
Please, Sign In to add comment