Skip to content

Instantly share code, notes, and snippets.

@kolobus
Created December 22, 2016 10:23
Show Gist options
  • Save kolobus/2cd4f922b4a521293ca667f4d5263ebe to your computer and use it in GitHub Desktop.
Save kolobus/2cd4f922b4a521293ca667f4d5263ebe to your computer and use it in GitHub Desktop.
Using jq example
#!/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