Skip to content

Instantly share code, notes, and snippets.

@sheerlox
Last active August 22, 2017 02:05
Show Gist options
  • Save sheerlox/b213d8cb073ce40b0ecbf1179305d539 to your computer and use it in GitHub Desktop.
Save sheerlox/b213d8cb073ce40b0ecbf1179305d539 to your computer and use it in GitHub Desktop.
Bitcoind synchronization monitor
#!/bin/bash
clear
while true; do
BLOCKS=$(bitcoin-cli -datadir=/bitcoin getblockchaininfo | grep 'blocks' | cut -d' ' -f4 | cut -d',' -f1)
SYNC=$(bitcoin-cli -datadir=/bitcoin getblockchaininfo | grep 'progress' | cut -d' ' -f4 | cut -d',' -f1)
USED=$(df -h | grep bitcoin | sed -e's/ */ /g' | cut -d' ' -f3)
TOTAL=$(df -h | grep bitcoin | sed -e's/ */ /g' | cut -d' ' -f2)
echo -ne $BLOCKS blocks
echo -ne " | "
echo -ne $(echo "$SYNC * 100" | bc | cut -c1-5)%
echo -ne " | "
echo -ne $USED used on $TOTAL \\r
sleep 1
done
@sheerlox
Copy link
Author

Output:
239180 blocks | 7.578% | 9.6G used on 197G

Adapt the USED and TOTAL grep command for getting the right HDD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment