The core protocol of WoopChain
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
woop/scripts/mystatus.sh

75 lines
2.0 KiB

6 years ago
#!/bin/bash
function usage
{
cat<<EOT
Usage: $0 [option] command
Option:
-h print this help
Monitor Help:
Actions:
1. status - Generates a status report of your node
EOT
exit 0
6 years ago
}
while getopts "h" opt; do
case $opt in
h) usage ;;
*) usage ;;
esac
6 years ago
done
6 years ago
currentBlockHeight="otherHeight"
myBlockChainHeight="myHeight"
heightStatus=$(grep $currentBlockHeight ./latest/validator*.log | egrep -o $myBlockChainHeight"(.*)([0-9]+)," | tail -n 1)
6 years ago
# Which Shard
6 years ago
my_shard=$(egrep -o "shardID\"\:[0-9]+" ./latest/validator*.log | tail -n 1 | cut -f2 -d ":")
6 years ago
# Which IP
6 years ago
ip=$(curl -s http://169.254.169.254/latest/meta-data/public-ipv4)
6 years ago
6 years ago
bingos=$(grep -c "BINGO" ./latest/validator*log)
# balances=$(./wallet.sh balances)
status=$(tac ./latest/* | egrep -m1 'BINGO|HOORAY' | \
grep ViewID | \
python -c $'import datetime, sys, json;\nfor x in sys.stdin:\n y = json.loads(x); print "%10s %s %s" % (y.get("ViewID", "*" + str(y.get("myViewID", 0))), datetime.datetime.strftime(datetime.datetime.strptime(y["t"][:-4], "%Y-%m-%dT%H:%M:%S.%f") + datetime.timedelta(hours=-7), "%m/%d %H:%M:%S.%f"), y["ip"])')
6 years ago
lengthOfChain=$(cat $status | cut -f1 -d " ")
#sudo /sbin/ldconfig -v
#nodeVersion=$(LD_LIBRARY_PATH=$(pwd) ./harmony -version)
6 years ago
#check if you're in snych
#Reward
#echo "Your Node Version : "
LD_LIBRARY_PATH=$(pwd) ./harmony -version
6 years ago
echo "Current Length of Chain : "$lengthOfChain
echo "Your Sync Status : "$heightStatus
echo "Your Shard : " $my_shard
echo "Your IP: " $ip
6 years ago
echo "Total Blocks Received After Syncing: " $bingos
echo "Your Rewards: "
6 years ago
./wallet.sh balances
# display the first block you started receiving
# show the percentage of earned / recieved
#Is your account registered
# ./wallet.sh format --address one1xhffyq90exjvmsz3vcykqkdqggrcedf7zdcvt8
# account address in Bech32: one1xhffyq90exjvmsz3vcykqkdqggrcedf7zdcvt8
# account address in Base16 (deprecated): 0x35D29200aFC9A4cDC05166096059a042078CB53e
# https://raw.githubusercontent.com/harmony-one/harmony/master/internal/genesis/foundational.go