mynode/rootfs/standard/usr/bin/mynode-get-bitcoin-ibd-data
2022-06-17 22:42:11 -05:00

26 lines
631 B
Bash
Executable File

#!/bin/bash
# Need to run as sudo
NUM_HOURS=24
export TZ="GMT"
# Check for arg to change hours
if [ "$#" -eq "1" ]; then
NUM_HOURS=$1
fi
echo "Bitcoin Blocks Processed per Hour"
echo "================================="
# Show current hour
d=$(date "+%Y-%m-%dT%H:")
c=$(grep --text "$d" /mnt/hdd/mynode/bitcoin/debug.log | grep "UpdateTip" | wc -l)
echo "${d}00 - ${d}59 | $c (current hour)"
# Show historical hours
for (( i=1; i<=$NUM_HOURS; i++ ))
do
d=$(date -d "$i hour ago" "+%Y-%m-%dT%H:")
c=$(grep --text "$d" /mnt/hdd/mynode/bitcoin/debug.log | grep "UpdateTip" | wc -l)
echo "${d}00 - ${d}59 | $c"
done