Created
July 23, 2017 03:03
-
-
Save pointbiz/ff5f33dc3db1e6599eb26d36e48a591a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#get current block height from blockchain.infoecho $(date) | |
wget -4 https://blockchain.info/q/getblockcount &> /dev/null | |
netblk=$(<getblockcount) | |
echo "Current Block: $netblk" | |
#get current block from local bitcoin-cli | |
./bitcoin-cli getblockcount > locblock | |
nodeblk=$(<locblock) | |
echo "Local Block: $nodeblk" | |
#if bitcoin-cli responds, compare local with network blocks | |
if [ "$nodeblk" == "" ]; then | |
echo "checking recent blocks. please wait" | |
else | |
diff=$((netblk-nodeblk)) | |
echo "$diff" "blocks behind" | |
rm getblockcount | |
rm locblock | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment