2018-10-16 00:26:08 +02:00
|
|
|
#!/bin/bash
|
2018-07-17 13:12:03 +02:00
|
|
|
|
2018-10-15 14:43:09 +02:00
|
|
|
# load code software version
|
|
|
|
source /home/admin/_version.info
|
|
|
|
|
2018-07-17 13:12:03 +02:00
|
|
|
# set colors
|
|
|
|
color_red='\033[0;31m'
|
|
|
|
color_green='\033[0;32m'
|
2019-02-22 16:14:12 +01:00
|
|
|
color_amber='\033[0;33m'
|
|
|
|
color_yellow='\033[1;93m'
|
2018-07-17 13:12:03 +02:00
|
|
|
color_gray='\033[0;37m'
|
2018-10-07 12:21:05 +02:00
|
|
|
color_purple='\033[0;35m'
|
2018-07-17 13:12:03 +02:00
|
|
|
|
2018-12-06 14:36:02 +01:00
|
|
|
## get basic info
|
|
|
|
source /home/admin/raspiblitz.info 2>/dev/null
|
2018-12-03 14:58:28 +01:00
|
|
|
source /mnt/hdd/raspiblitz.conf 2>/dev/null
|
2018-12-03 14:48:54 +01:00
|
|
|
|
2019-08-05 23:33:57 +02:00
|
|
|
# get UPS info
|
|
|
|
source <(/home/admin/config.scripts/blitz.ups.sh status)
|
|
|
|
upsInfo=""
|
|
|
|
if [ "${upsStatus}" = "ONLINE" ]; then
|
|
|
|
upsInfo="${color_gray}${upsBattery}"
|
|
|
|
fi
|
|
|
|
if [ "${upsStatus}" = "ONBATT" ]; then
|
|
|
|
upsInfo="${color_red}${upsBattery}"
|
|
|
|
fi
|
2019-08-06 14:37:01 +02:00
|
|
|
if [ "${upsStatus}" = "SHUTTING DOWN" ]; then
|
|
|
|
upsInfo="${color_red}DOWN"
|
|
|
|
fi
|
2019-08-05 23:33:57 +02:00
|
|
|
|
2018-12-06 14:36:02 +01:00
|
|
|
# check hostname
|
|
|
|
if [ ${#hostname} -eq 0 ]; then hostname="raspiblitz"; fi
|
2018-12-03 14:48:54 +01:00
|
|
|
|
2018-12-06 14:36:02 +01:00
|
|
|
# for oldnodes
|
2018-12-03 14:48:54 +01:00
|
|
|
if [ ${#network} -eq 0 ]; then
|
|
|
|
network="bitcoin"
|
|
|
|
litecoinActive=$(sudo ls /mnt/hdd/litecoin/litecoin.conf 2>/dev/null | grep -c 'litecoin.conf')
|
|
|
|
if [ ${litecoinActive} -eq 1 ]; then
|
|
|
|
network="litecoin"
|
|
|
|
else
|
|
|
|
network=`sudo cat /home/admin/.network 2>/dev/null`
|
|
|
|
fi
|
|
|
|
if [ ${#network} -eq 0 ]; then
|
|
|
|
network="bitcoin"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2018-12-06 14:36:02 +01:00
|
|
|
# for oldnodes
|
2018-12-03 14:48:54 +01:00
|
|
|
if [ ${#chain} -eq 0 ]; then
|
|
|
|
chain="test"
|
|
|
|
isMainChain=$(sudo cat /mnt/hdd/${network}/${network}.conf 2>/dev/null | grep "#testnet=1" -c)
|
|
|
|
if [ ${isMainChain} -gt 0 ];then
|
|
|
|
chain="main"
|
|
|
|
fi
|
2018-08-24 20:35:55 +02:00
|
|
|
fi
|
|
|
|
|
2018-07-17 13:12:03 +02:00
|
|
|
# set datadir
|
2018-07-29 01:33:54 +02:00
|
|
|
bitcoin_dir="/home/bitcoin/.${network}"
|
2018-07-17 13:12:03 +02:00
|
|
|
lnd_dir="/home/bitcoin/.lnd"
|
2018-08-24 20:35:55 +02:00
|
|
|
lnd_macaroon_dir="/home/bitcoin/.lnd/data/chain/${network}/${chain}net"
|
2018-07-17 13:12:03 +02:00
|
|
|
|
|
|
|
# get uptime & load
|
2018-08-23 01:33:14 +02:00
|
|
|
load=$(w | head -n 1 | cut -d 'v' -f2 | cut -d ':' -f2)
|
2018-07-17 13:12:03 +02:00
|
|
|
|
2019-05-08 15:34:33 +02:00
|
|
|
# get CPU temp - no measurement in a VM
|
2019-05-08 14:48:35 +02:00
|
|
|
cpu=0
|
2019-05-08 15:22:15 +02:00
|
|
|
if [ -d "/sys/class/thermal/thermal_zone0/" ]; then
|
2019-05-08 14:48:35 +02:00
|
|
|
cpu=$(cat /sys/class/thermal/thermal_zone0/temp)
|
|
|
|
fi
|
2019-04-11 23:05:33 +02:00
|
|
|
tempC=$((cpu/1000))
|
2019-06-12 14:33:10 +02:00
|
|
|
tempF=$(((tempC * 18 + 325) / 10))
|
2018-07-17 13:12:03 +02:00
|
|
|
|
|
|
|
# get memory
|
|
|
|
ram_avail=$(free -m | grep Mem | awk '{ print $7 }')
|
|
|
|
ram=$(printf "%sM / %sM" "${ram_avail}" "$(free -m | grep Mem | awk '{ print $2 }')")
|
|
|
|
|
2019-04-16 23:45:57 +02:00
|
|
|
if [ ${ram_avail} -lt 50 ]; then
|
2018-07-17 13:12:03 +02:00
|
|
|
color_ram="${color_red}\e[7m"
|
|
|
|
else
|
|
|
|
color_ram=${color_green}
|
|
|
|
fi
|
|
|
|
|
2019-06-11 14:02:22 +02:00
|
|
|
# HDD usage
|
2019-06-12 19:47:11 +02:00
|
|
|
hdd_used_space=$(df -h | grep "/dev/sda" | sed -e's/ */ /g' | cut -d" " -f 3 2>/dev/null)
|
2019-06-12 20:17:03 +02:00
|
|
|
hdd_used_ratio=$(df -h | grep "/dev/sda" | sed -e's/ */ /g' | cut -d" " -f 5 | tr -dc '0-9' 2>/dev/null)
|
2019-06-11 14:02:22 +02:00
|
|
|
hdd="${hdd_used_space} (${hdd_used_ratio}%)"
|
2018-07-17 13:12:03 +02:00
|
|
|
|
2019-06-11 14:02:22 +02:00
|
|
|
if [ ${hdd_used_ratio} -gt 90 ]; then
|
2018-07-17 13:12:03 +02:00
|
|
|
color_hdd="${color_red}\e[7m"
|
|
|
|
else
|
|
|
|
color_hdd=${color_green}
|
|
|
|
fi
|
|
|
|
|
|
|
|
# get network traffic
|
2019-05-08 15:34:33 +02:00
|
|
|
# ifconfig does not show eth0 on Armbian or in a VM - get first traffic info
|
2019-04-14 19:56:01 +02:00
|
|
|
isArmbian=$(cat /etc/os-release 2>/dev/null | grep -c 'Debian')
|
2019-05-08 15:34:33 +02:00
|
|
|
if [ ${isArmbian} -gt 0 ] || [ ! -d "/sys/class/thermal/thermal_zone0/" ]; then
|
2019-04-14 19:56:01 +02:00
|
|
|
network_rx=$(ifconfig | grep -m1 'RX packets' | awk '{ print $6$7 }' | sed 's/[()]//g')
|
|
|
|
network_tx=$(ifconfig | grep -m1 'TX packets' | awk '{ print $6$7 }' | sed 's/[()]//g')
|
|
|
|
else
|
|
|
|
network_rx=$(ifconfig eth0 | grep 'RX packets' | awk '{ print $6$7 }' | sed 's/[()]//g')
|
|
|
|
network_tx=$(ifconfig eth0 | grep 'TX packets' | awk '{ print $6$7 }' | sed 's/[()]//g')
|
|
|
|
fi
|
2018-07-17 13:12:03 +02:00
|
|
|
|
|
|
|
# Bitcoin blockchain
|
2018-07-29 01:33:54 +02:00
|
|
|
btc_path=$(command -v ${network}-cli)
|
2018-07-17 13:12:03 +02:00
|
|
|
if [ -n ${btc_path} ]; then
|
2018-07-29 01:33:54 +02:00
|
|
|
btc_title=$network
|
2018-10-16 01:07:15 +02:00
|
|
|
blockchaininfo="$(${network}-cli -datadir=${bitcoin_dir} getblockchaininfo 2>/dev/null)"
|
2018-08-25 13:00:58 +02:00
|
|
|
if [ ${#blockchaininfo} -gt 0 ]; then
|
2018-07-17 13:12:03 +02:00
|
|
|
btc_title="${btc_title} (${chain}net)"
|
|
|
|
|
|
|
|
# get sync status
|
2018-10-16 01:07:15 +02:00
|
|
|
block_chain="$(${network}-cli -datadir=${bitcoin_dir} getblockcount 2>/dev/null)"
|
2018-08-24 20:35:55 +02:00
|
|
|
block_verified="$(echo "${blockchaininfo}" | jq -r '.blocks')"
|
2018-07-17 13:12:03 +02:00
|
|
|
block_diff=$(expr ${block_chain} - ${block_verified})
|
|
|
|
|
2018-08-24 20:35:55 +02:00
|
|
|
progress="$(echo "${blockchaininfo}" | jq -r '.verificationprogress')"
|
2019-03-08 14:16:13 +01:00
|
|
|
sync_percentage=$(echo $progress | awk '{printf( "%.2f%%", 100 * $1)}')
|
2018-07-17 13:12:03 +02:00
|
|
|
|
|
|
|
if [ ${block_diff} -eq 0 ]; then # fully synced
|
|
|
|
sync="OK"
|
|
|
|
sync_color="${color_green}"
|
|
|
|
sync_behind=" "
|
2018-11-13 20:05:08 +01:00
|
|
|
elif [ ${block_diff} -eq 1 ]; then # fully synced
|
2018-07-17 13:12:03 +02:00
|
|
|
sync="OK"
|
|
|
|
sync_color="${color_green}"
|
|
|
|
sync_behind="-1 block"
|
2018-11-13 20:05:08 +01:00
|
|
|
elif [ ${block_diff} -le 10 ]; then # <= 2 blocks behind
|
|
|
|
sync=""
|
2018-07-17 13:12:03 +02:00
|
|
|
sync_color="${color_red}"
|
|
|
|
sync_behind="-${block_diff} blocks"
|
|
|
|
else
|
2018-11-13 20:05:08 +01:00
|
|
|
sync=""
|
2018-07-17 13:12:03 +02:00
|
|
|
sync_color="${color_red}"
|
|
|
|
sync_behind="${sync_percentage}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# get last known block
|
2018-10-16 01:07:15 +02:00
|
|
|
last_block="$(${network}-cli -datadir=${bitcoin_dir} getblockcount 2>/dev/null)"
|
2018-07-17 13:12:03 +02:00
|
|
|
if [ ! -z "${last_block}" ]; then
|
|
|
|
btc_line2="${btc_line2} ${color_gray}(block ${last_block})"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# get mem pool transactions
|
2018-10-16 01:07:15 +02:00
|
|
|
mempool="$(${network}-cli -datadir=${bitcoin_dir} getmempoolinfo 2>/dev/null | jq -r '.size')"
|
2018-07-17 13:12:03 +02:00
|
|
|
|
|
|
|
else
|
|
|
|
btc_line2="${color_red}NOT RUNNING\t\t"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# get IP address & port
|
2018-10-16 01:07:15 +02:00
|
|
|
networkInfo=$(${network}-cli -datadir=${bitcoin_dir} getnetworkinfo 2>/dev/null)
|
2018-07-17 13:12:03 +02:00
|
|
|
local_ip=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
2018-12-11 13:15:15 +01:00
|
|
|
public_ip="${publicIP}"
|
2018-10-07 12:57:59 +02:00
|
|
|
public_port="$(echo ${networkInfo} | jq -r '.localaddresses [0] .port')"
|
2018-10-18 23:23:58 +02:00
|
|
|
if [ "${public_port}" = "null" ]; then
|
2018-12-05 11:35:09 +01:00
|
|
|
if [ "${chain}" = "test" ]; then
|
|
|
|
public_port="18333"
|
|
|
|
else
|
|
|
|
public_port="8333"
|
|
|
|
fi
|
2018-10-18 23:23:58 +02:00
|
|
|
fi
|
2018-07-17 13:12:03 +02:00
|
|
|
|
2018-11-04 00:52:31 +01:00
|
|
|
# check if RTL web interface is installed
|
|
|
|
webinterfaceInfo=""
|
2018-11-04 01:05:22 +01:00
|
|
|
runningRTL=$(sudo ls /etc/systemd/system/RTL.service 2>/dev/null | grep -c 'RTL.service')
|
2018-11-04 00:52:31 +01:00
|
|
|
if [ ${runningRTL} -eq 1 ]; then
|
|
|
|
webinterfaceInfo="web admin --> ${color_green}http://${local_ip}:3000"
|
|
|
|
fi
|
|
|
|
|
2018-08-21 03:52:14 +02:00
|
|
|
# CHAIN NETWORK
|
2019-01-15 02:58:39 +01:00
|
|
|
public_addr_pre="Public "
|
2018-08-15 12:12:21 +02:00
|
|
|
public_addr="??"
|
|
|
|
torInfo=""
|
2018-08-22 12:32:10 +02:00
|
|
|
# Version
|
2018-10-16 01:07:15 +02:00
|
|
|
networkVersion=$(${network}-cli -datadir=${bitcoin_dir} -version 2>/dev/null | cut -d ' ' -f6)
|
2018-08-15 12:12:21 +02:00
|
|
|
# TOR or IP
|
2018-10-07 13:57:23 +02:00
|
|
|
networkInfo=$(${network}-cli -datadir=${bitcoin_dir} getnetworkinfo)
|
|
|
|
networkConnections=$(echo ${networkInfo} | jq -r '.connections')
|
2018-10-07 12:21:05 +02:00
|
|
|
networkConnectionsInfo="${color_purple}${networkConnections} ${color_gray}connections"
|
2019-01-28 13:15:01 +01:00
|
|
|
|
|
|
|
if [ "${runBehindTor}" = "on" ]; then
|
|
|
|
|
2018-08-15 12:12:21 +02:00
|
|
|
# TOR address
|
2019-01-28 13:15:01 +01:00
|
|
|
onionAddress=$(echo ${networkInfo} | jq -r '.localaddresses [0] .address')
|
2018-12-12 20:14:45 +01:00
|
|
|
networkConnectionsInfo="${color_purple}${networkConnections} ${color_gray}peers"
|
2018-08-15 12:12:21 +02:00
|
|
|
public_addr="${onionAddress}:${public_port}"
|
|
|
|
public=""
|
2018-07-17 13:12:03 +02:00
|
|
|
public_color="${color_green}"
|
2018-08-15 12:12:21 +02:00
|
|
|
torInfo="+ TOR"
|
2019-01-28 13:15:01 +01:00
|
|
|
|
2018-07-17 13:12:03 +02:00
|
|
|
else
|
2019-01-17 17:46:25 +01:00
|
|
|
|
2018-08-15 12:12:21 +02:00
|
|
|
# IP address
|
2018-12-12 20:14:45 +01:00
|
|
|
networkConnectionsInfo="${color_purple}${networkConnections} ${color_gray}connections"
|
2018-08-15 12:12:21 +02:00
|
|
|
public_addr="${public_ip}:${public_port}"
|
2018-12-12 13:34:25 +01:00
|
|
|
public_check=$(nc -z -w6 ${public_ip} ${public_port} 2>/dev/null; echo $?)
|
2018-08-15 12:12:21 +02:00
|
|
|
if [ $public_check = "0" ]; then
|
2018-12-05 11:35:09 +01:00
|
|
|
public=""
|
2018-12-12 13:53:22 +01:00
|
|
|
# only set yellow/normal because netcat can only say that the port is open - not that it points to this device for sure
|
2019-02-22 16:14:12 +01:00
|
|
|
public_color="${color_amber}"
|
2018-08-15 12:12:21 +02:00
|
|
|
else
|
2018-12-05 11:35:09 +01:00
|
|
|
public=""
|
2018-08-15 12:12:21 +02:00
|
|
|
public_color="${color_red}"
|
|
|
|
fi
|
2019-01-17 17:46:25 +01:00
|
|
|
|
|
|
|
# DynDNS
|
2019-01-17 17:47:32 +01:00
|
|
|
if [ ${#dynDomain} -gt 0 ]; then
|
2019-01-17 17:46:25 +01:00
|
|
|
|
|
|
|
#check if dyndns resolves to correct IP
|
2019-02-03 00:08:25 +01:00
|
|
|
ipOfDynDNS=$(getent hosts ${dynDomain} | awk '{ print $1 }')
|
2019-01-17 17:49:59 +01:00
|
|
|
if [ "${ipOfDynDNS}:${public_port}" != "${public_addr}" ]; then
|
2019-01-17 17:46:25 +01:00
|
|
|
public_color="${color_red}"
|
|
|
|
else
|
2019-02-22 16:14:12 +01:00
|
|
|
public_color="${color_amber}"
|
2019-01-17 17:46:25 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
# replace IP display with dynDNS
|
|
|
|
public_addr_pre="DynDNS "
|
|
|
|
public_addr="${dynDomain}"
|
2019-02-22 15:54:20 +01:00
|
|
|
fi
|
2019-01-17 17:46:25 +01:00
|
|
|
|
2019-02-22 15:54:20 +01:00
|
|
|
if [ ${#public_addr} -gt 25 ]; then
|
|
|
|
# if a IPv6 address dont show peers to save space
|
|
|
|
networkConnectionsInfo=""
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ${#public_addr} -gt 35 ]; then
|
|
|
|
# if a LONG IPv6 address dont show "Public" in front to save space
|
|
|
|
public_addr_pre=""
|
2019-01-17 17:46:25 +01:00
|
|
|
fi
|
|
|
|
|
2018-07-17 13:12:03 +02:00
|
|
|
fi
|
|
|
|
|
2018-08-21 03:52:14 +02:00
|
|
|
# LIGHTNING NETWORK
|
2018-08-22 12:32:10 +02:00
|
|
|
|
2018-08-22 13:52:16 +02:00
|
|
|
ln_baseInfo="-"
|
2018-08-23 04:29:33 +02:00
|
|
|
ln_channelInfo="\n"
|
2018-10-19 00:39:45 +02:00
|
|
|
ln_external="\n"
|
2018-12-03 14:48:54 +01:00
|
|
|
ln_alias="${hostname}"
|
2018-12-12 13:34:25 +01:00
|
|
|
ln_publicColor=""
|
2019-03-17 16:11:28 +01:00
|
|
|
ln_port=$(sudo cat /mnt/hdd/lnd/lnd.conf | grep "^listen=*" | cut -f2 -d':')
|
|
|
|
if [ ${#ln_port} -eq 0 ]; then
|
|
|
|
ln_port="9735"
|
|
|
|
fi
|
2018-08-21 03:52:14 +02:00
|
|
|
|
2018-10-07 20:49:21 +02:00
|
|
|
wallet_unlocked=$(sudo tail -n 1 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log 2> /dev/null | grep -c unlock)
|
2018-08-22 12:54:11 +02:00
|
|
|
if [ "$wallet_unlocked" -gt 0 ] ; then
|
2018-07-17 13:12:03 +02:00
|
|
|
alias_color="${color_red}"
|
|
|
|
ln_alias="Wallet Locked"
|
|
|
|
else
|
2018-08-25 12:55:46 +02:00
|
|
|
ln_getInfo=$(sudo -u bitcoin /usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert getinfo 2>/dev/null)
|
2018-08-23 00:14:12 +02:00
|
|
|
ln_external=$(echo "${ln_getInfo}" | grep "uris" -A 1 | tr -d '\n' | cut -d '"' -f4)
|
2018-12-12 13:34:25 +01:00
|
|
|
ln_tor=$(echo "${ln_external}" | grep -c ".onion")
|
|
|
|
if [ ${ln_tor} -eq 1 ]; then
|
|
|
|
ln_publicColor="${color_green}"
|
|
|
|
else
|
2019-03-17 16:11:28 +01:00
|
|
|
public_check=$(nc -z -w6 ${public_ip} ${ln_port} 2>/dev/null; echo $?)
|
2018-12-12 13:34:25 +01:00
|
|
|
if [ $public_check = "0" ]; then
|
2018-12-12 13:53:22 +01:00
|
|
|
# only set yellow/normal because netcat can only say that the port is open - not that it points to this device for sure
|
2019-02-22 16:14:12 +01:00
|
|
|
ln_publicColor="${color_amber}"
|
2018-12-12 13:34:25 +01:00
|
|
|
else
|
|
|
|
ln_publicColor="${color_red}"
|
|
|
|
fi
|
|
|
|
fi
|
2018-07-17 13:12:03 +02:00
|
|
|
alias_color="${color_grey}"
|
2018-08-22 13:52:16 +02:00
|
|
|
ln_sync=$(echo "${ln_getInfo}" | grep "synced_to_chain" | grep "true" -c)
|
2018-11-29 12:48:12 +01:00
|
|
|
ln_version=$(echo "${ln_getInfo}" | jq -r '.version' | cut -d' ' -f1)
|
2018-08-22 13:52:16 +02:00
|
|
|
if [ ${ln_sync} -eq 0 ]; then
|
2018-08-22 21:42:57 +02:00
|
|
|
if [ ${#ln_getInfo} -eq 0 ]; then
|
2018-08-25 12:55:46 +02:00
|
|
|
ln_baseInfo="${color_red} Not Started | Not Ready Yet"
|
2018-08-22 21:37:30 +02:00
|
|
|
else
|
2018-11-06 14:49:00 +01:00
|
|
|
item=$(sudo -u bitcoin tail -n 100 /mnt/hdd/lnd/logs/${network}/${chain}net/lnd.log 2> /dev/null | grep "(height" | tail -n1 | awk '{print $10} {print $11} {print $12}' | tr -dc '0-9')
|
2018-10-16 01:11:56 +02:00
|
|
|
total=$(sudo -u bitcoin ${network}-cli -datadir=/home/bitcoin/.${network} getblockchaininfo 2>/dev/null | jq -r '.blocks')
|
2018-08-22 21:37:30 +02:00
|
|
|
ln_baseInfo="${color_red} waiting for chain sync"
|
2018-08-23 04:29:33 +02:00
|
|
|
if [ ${#item} -gt 0 ]; then
|
2018-08-23 04:30:45 +02:00
|
|
|
ln_channelInfo="scanning ${item}/${total}"
|
2018-10-07 12:21:05 +02:00
|
|
|
fi
|
2018-08-22 21:37:30 +02:00
|
|
|
fi
|
2018-10-07 12:21:05 +02:00
|
|
|
else
|
2018-08-25 13:00:58 +02:00
|
|
|
ln_walletbalance="$(sudo -u bitcoin /usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert walletbalance | jq -r '.confirmed_balance')" 2>/dev/null
|
2018-12-03 18:04:37 +01:00
|
|
|
ln_walletbalance_wait="$(sudo -u bitcoin /usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert walletbalance | jq -r '.unconfirmed_balance')" 2>/dev/null
|
2018-12-03 18:06:03 +01:00
|
|
|
if [ "${ln_walletbalance_wait}" = "0" ]; then ln_walletbalance_wait=""; fi
|
|
|
|
if [ ${#ln_walletbalance_wait} -gt 0 ]; then ln_walletbalance_wait="(+${ln_walletbalance_wait})"; fi
|
2018-08-25 13:00:58 +02:00
|
|
|
ln_channelbalance="$(sudo -u bitcoin /usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert channelbalance | jq -r '.balance')" 2>/dev/null
|
2019-04-17 09:37:35 +02:00
|
|
|
ln_channelbalance_pending="$(sudo -u bitcoin /usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert channelbalance | jq -r '.pending_open_balance')" 2>/dev/null
|
|
|
|
if [ "${ln_channelbalance_pending}" = "0" ]; then ln_channelbalance_pending=""; fi
|
|
|
|
if [ ${#ln_channelbalance_pending} -gt 0 ]; then ln_channelbalance_pending=" (+${ln_channelbalance_pending})"; fi
|
2018-08-22 13:52:16 +02:00
|
|
|
ln_channels_online="$(echo "${ln_getInfo}" | jq -r '.num_active_channels')" 2>/dev/null
|
2018-08-25 13:00:58 +02:00
|
|
|
ln_channels_total="$(sudo -u bitcoin /usr/local/bin/lncli --macaroonpath=${lnd_macaroon_dir}/readonly.macaroon --tlscertpath=${lnd_dir}/tls.cert listchannels | jq '.[] | length')" 2>/dev/null
|
2018-12-03 18:04:37 +01:00
|
|
|
ln_baseInfo="${color_gray}wallet ${ln_walletbalance} sat ${ln_walletbalance_wait}"
|
2018-10-07 12:21:05 +02:00
|
|
|
ln_peers="$(echo "${ln_getInfo}" | jq -r '.num_peers')" 2>/dev/null
|
2019-04-17 09:37:35 +02:00
|
|
|
ln_channelInfo="${ln_channels_online}/${ln_channels_total} Channels ${ln_channelbalance} sat${ln_channelbalance_pending}"
|
2018-10-07 12:21:05 +02:00
|
|
|
ln_peersInfo="${color_purple}${ln_peers} ${color_gray}peers"
|
2018-08-22 13:52:16 +02:00
|
|
|
fi
|
2018-08-22 12:32:10 +02:00
|
|
|
fi
|
2018-07-17 13:12:03 +02:00
|
|
|
|
2018-08-15 12:12:21 +02:00
|
|
|
sleep 5
|
2019-07-03 03:39:42 +02:00
|
|
|
clear
|
2018-08-05 06:39:01 +02:00
|
|
|
printf "
|
2018-07-17 13:12:03 +02:00
|
|
|
${color_yellow}
|
|
|
|
${color_yellow}
|
|
|
|
${color_yellow}
|
2019-08-05 23:33:57 +02:00
|
|
|
${color_yellow} ${color_amber}%s ${color_green} ${ln_alias} ${upsInfo}
|
2018-08-23 00:21:27 +02:00
|
|
|
${color_yellow} ${color_gray}${network} Fullnode + Lightning Network ${torInfo}
|
|
|
|
${color_yellow} ,/ ${color_yellow}%s
|
2019-04-11 23:47:46 +02:00
|
|
|
${color_yellow} ,'/ ${color_gray}%s, temp %s°C %s°F
|
2019-06-11 14:02:22 +02:00
|
|
|
${color_yellow} ,' / ${color_gray}Free Mem ${color_ram}${ram} ${color_gray} HDDuse ${color_hdd}%s${color_gray}
|
2019-07-03 20:55:44 +02:00
|
|
|
${color_yellow} ,' /_____, ${color_gray}ssh admin@${color_green}${local_ip}${color_gray} d${network_rx} u${network_tx}
|
2018-11-04 00:52:31 +01:00
|
|
|
${color_yellow} .'____ ,' ${color_gray}${webinterfaceInfo}
|
2019-06-29 20:24:20 +02:00
|
|
|
${color_yellow} / ,' ${color_gray}${network} ${color_green}${networkVersion} ${chain}net ${color_gray}Sync ${sync_color}${sync} %s
|
2019-01-15 22:35:41 +01:00
|
|
|
${color_yellow} / ,' ${color_gray}${public_addr_pre}${public_color}${public_addr} ${public}${networkConnectionsInfo}
|
2018-08-23 00:21:27 +02:00
|
|
|
${color_yellow} /,' ${color_gray}
|
2018-11-29 12:48:12 +01:00
|
|
|
${color_yellow} /' ${color_gray}LND ${color_green}${ln_version} ${ln_baseInfo}
|
2018-10-07 12:21:05 +02:00
|
|
|
${color_yellow} ${color_gray}${ln_channelInfo} ${ln_peersInfo}
|
2018-08-22 14:26:09 +02:00
|
|
|
${color_yellow}
|
2019-03-17 18:07:06 +01:00
|
|
|
${color_yellow}${ln_publicColor}${ln_external}${color_red}
|
2018-12-12 18:35:07 +01:00
|
|
|
|
2018-07-17 13:12:03 +02:00
|
|
|
" \
|
2018-10-15 14:43:09 +02:00
|
|
|
"RaspiBlitz v${codeVersion}" \
|
2018-07-17 13:12:03 +02:00
|
|
|
"-------------------------------------------" \
|
2019-04-11 23:47:46 +02:00
|
|
|
"CPU load${load##up*, }" "${tempC}" "${tempF}" \
|
2018-07-17 13:12:03 +02:00
|
|
|
"${hdd}" "${sync_percentage}"
|
2019-03-15 15:43:16 +01:00
|
|
|
|
2019-04-10 17:07:31 +02:00
|
|
|
source /home/admin/stresstest.report 2>/dev/null
|
2019-03-15 15:54:47 +01:00
|
|
|
if [ ${#undervoltageReports} -gt 0 ] && [ "${undervoltageReports}" != "0" ]; then
|
2019-04-10 17:08:25 +02:00
|
|
|
echo "${undervoltageReports} undervoltage reports - run 'Hardware Test' in menu"
|
2019-04-10 17:02:05 +02:00
|
|
|
elif [ ${#powerFAIL} -gt 0 ] && [ ${powerFAIL} -gt 0 ]; then
|
2019-04-10 17:08:25 +02:00
|
|
|
echo "Weak power supply detected - run 'Hardware Test' in menu"
|
2019-08-06 15:04:19 +02:00
|
|
|
elif [ ${#ups} -gt 1 ] && [ "${upsStatus}" = "n/a" ]; then
|
2019-08-07 21:49:16 +02:00
|
|
|
echo "UPS service activated but not running"
|
2019-08-06 15:02:06 +02:00
|
|
|
fi
|