Created
December 22, 2016 10:23
-
-
Save kolobus/2cd4f922b4a521293ca667f4d5263ebe to your computer and use it in GitHub Desktop.
Using jq example
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 | |
cd /mnt/heartbeat | |
/usr/bin/docker exec heartbeat komodo-cli getinfo > www/heartbeat.json | |
bid=$(cat www/heartbeat.json | jq '.blocks') | |
notarized=$(cat www/heartbeat.json | jq '.notarized') | |
nhash=$(cat www/heartbeat.json | jq '.notarizedhash' | sed -e 's/"//g') | |
txid=$(cat www/heartbeat.json | jq '.notarizedtxid' | sed -e 's/"//g') | |
diff=$(cat www/heartbeat.json | jq '.difficulty') | |
let "blockid = $bid - 3" | |
blockhash=$(/usr/bin/docker exec heartbeat komodo-cli getblockhash $blockid) | |
printf "Block $blockid: $blockhash\nDifficulty: $diff\nNotarized $notarized: $nhash\nBTC tx: http://blockr.io/tx/info/$txid" | /mnt/heartbeat/slacktee.sh > /dev/null 2> /dev/null | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment