You are viewing a single comment's thread from:
RE: Showing Real Time Block/Witness in Witness Page
Just because I needed something to occupy my time, here's something similar in bash shell script for linux...
#!/bin/bash
# Take API from first command line argument. Use steemit if none given.
STEEMAPI="${1:-https://api.steemit.com}"
show_time_block_witness()
{
NOW=$(date)
curl -s --data '{"jsonrpc":"2.0", "method":"condenser_api.get_dynamic_global_properties", "params":[], "id":1}' ${STEEMAPI} \
2>/dev/null \
| jq -c -S '.result | {head_block_number, current_witness}' \
| tr '[,:"{}]' ' ' \
| ( read LBL1 BLOCK LBL2 WITNESS ; echo ${NOW}: ${BLOCK} ${WITNESS} )
}
SLEEPTIME=3
MAX=20 # Approximately 1 minute
for (( i=1; i <= ${MAX} ; i++ ))
do
sleep ${SLEEPTIME} &
show_time_block_witness
wait
done
Nice. thank you!