How many hours/minutes or blocks are there since last time you generate a block as a witness? Today we are going to find out the answer using the LINUX AWK programming.
First, we know that if you run docker logs [Your Container ID] you will see lots of log messages, such as:
The ./run.sh logs prints a tail-ed messages and we can to grep “Generated” to see the list of blocks:
So the next thing is to get the 8-th column with prints the block number. Using AWK, we know the 8-th column is stored in $8 and we can use the following Linux command to print the number of blocks since last commit and the hours passed (steemit generates a block every 3 seconds);
NR is the row number in AWK, and substr($8, 2) removes the hash tag.
{
cur=substr($8,2);
if (NR>1){
print "blocks=",cur-prev," hours=", (cur-prev)*3/3600
}
prev=cur;
}
The complete command is:
docker logs [Replace with your Container ID] | grep "Generated" | awk '{cur=substr($8,2);if (NR>1){print "blocks=",cur-prev," hours=",(cur-prev)*3/3600}prev=cur;}'
Yeah, I am getting faster and faster… Please help me to achieve my aim of producing a block every hour by voting me as a witness. (SteemIt Witness Post: Just another Witness)
You may also like: 使用AWK来看见证人生成块的速度
–EOF (The Ultimate Computing & Technology Blog) —
loading...
Last Post: SteemTool v0.0.9 - Sending Money to Multiple Addresses!
Next Post: Turtle Programming: Fractal Stars, Random, Console, Eraser, SetPC, SetXY, Examples, Wait, Bug Fixes and So much more!