forked from nuieskater/MN-SETUP
-
Notifications
You must be signed in to change notification settings - Fork 8
/
nodemon.sh
33 lines (29 loc) · 2 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
32
33
#!/bin/bash
# nodemon 1.0 - Reden Masternode Monitoring
#Processing command line params
if [ -z $1 ]; then dly=1; else dly=$1; fi # Default refresh time is 1 sec
datadir="/$USER/.redencore$2" # Default datadir is /root/.redencore
# 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 Reden nodes [reden datadir: $datadir]
===========================================================================
Node IP Ping Rx/Tx Since Hdrs Height Time Ban
Address (ms) (KBytes) Block Syncd Blocks (min) Score
==========================================================================='
reden-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# reden-cli masternode status' && reden-cli -datadir=$datadir masternode status
echo '==========================================================================='
echo 'Sync Status: \n# reden-cli mnsync status' && reden-cli -datadir=$datadir mnsync status
echo '==========================================================================='
echo 'Masternode Information: \n# reden-cli getinfo' && reden-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 redend in /$USER/.redencore22'
echo '\n\nPress Ctrl-C to Exit...'"