-
Notifications
You must be signed in to change notification settings - Fork 2
/
nodemon.sh
31 lines (27 loc) · 1.88 KB
/
nodemon.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# nodemon 1.0 - Vertical Masternode Monitoring
#Processing command line params
if [ -z $1 ]; then dly=1; else dly=$1; fi # Default refresh time is 1 sec
datadir="/$USER/.verticalcoin$2" # Default datadir is /root/.verticalcoin
# Install jq if it's not present
dpkg -s jq 2>/dev/null >/dev/null || sudo apt-get -y install jq
#It is a one-liner script for now
watch -ptn $dly "echo '===========================================================================
Outbound connections to other Vertical nodes [Vertical datadir: $datadir]
===========================================================================
Node IP Ping Rx/Tx Since Hdrs Height Time Ban
Address (ms) (KBytes) Block Syncd Blocks (min) Score
==========================================================================='
./verticalcoin-cli -datadir=$datadir getpeerinfo | jq -r '.[] | select(.inbound==false) | \"\(.addr),\(.pingtime*1000|floor) ,\
\(.bytesrecv/1024|floor)/\(.bytessent/1024|floor),\(.startingheight) ,\(.synced_headers) ,\(.synced_blocks) ,\
\((now-.conntime)/60|floor) ,\(.banscore)\"' | column -t -s ',' &&
echo '==========================================================================='
uptime
echo '==========================================================================='
echo 'Masternode Status: \n# ./verticalcoin-cli vnode status' && ./verticalcoin-cli -datadir=$datadir vnode status
echo '==========================================================================='
echo 'Masternode Information: \n# ./verticalcoin-cli getinfo' && ./verticalcoin-cli -datadir=$datadir getinfo
echo '==========================================================================='
echo 'Usage: nodemon.sh [refresh delay] [datadir index]'
echo 'Example: nodemon.sh 10 22 will run every 10 seconds and query verticalcoind in /$USER/.verticalcoin22'
echo '\n\nPress Ctrl-C to Exit...'"