raspiblitz/home.admin/80scanLND.sh

174 lines
5.4 KiB
Bash
Raw Normal View History

2019-02-02 23:49:04 +01:00
#!/bin/bash
2019-04-16 22:00:49 +01:00
source /home/admin/_version.info
2019-02-02 23:49:04 +01:00
source /home/admin/raspiblitz.info
2019-02-05 18:24:33 +01:00
source /mnt/hdd/raspiblitz.conf
2018-08-24 00:11:33 +02:00
2019-04-23 16:22:29 +02:00
# all system/service info gets detected by blitz.statusscan.sh
2019-04-16 21:48:22 +01:00
source <(sudo /home/admin/config.scripts/blitz.statusscan.sh)
2019-04-23 16:22:29 +02:00
# set follow up info different for LCD and ADMIN
2019-04-16 22:07:59 +01:00
adminStr="ssh admin@${localIP} ->Password A"
if [ "$USER" == "admin" ]; then
adminStr="Use CTRL+c to EXIT to Terminal"
fi
2018-08-02 18:45:09 +02:00
2019-04-23 16:22:29 +02:00
# bitcoin errors always first
2019-04-17 00:26:30 +01:00
if [ ${bitcoinActive} -eq 0 ] || [ ${#bitcoinErrorFull} -gt 0 ]; then
2019-04-16 22:23:06 +01:00
####################
# On Bitcoin Error
####################
2019-04-16 23:38:59 +01:00
height=5
2019-04-17 00:30:39 +01:00
width=43
2019-04-16 23:16:49 +01:00
title="Blockchain Info"
2019-04-23 15:12:15 +02:00
if [ ${uptime} -gt 600 ]; then
2019-04-16 23:34:53 +01:00
infoStr=" The ${network}d service is not running.\n Login for more details:"
if [ "$USER" == "admin" ]; then
2019-04-24 16:59:28 +02:00
clear
2019-04-16 23:34:53 +01:00
echo ""
echo "*****************************************"
echo "* The ${network}d service is not running."
echo "*****************************************"
echo "If you just started some config/setup, this might be OK."
2019-04-16 23:09:38 +01:00
echo
2019-04-24 13:47:58 +02:00
if [ ${startcountBlockchain} -gt 1 ]; then
echo "${startcountBlockchain} RESTARTS DETECTED - ${network}d might be in a error loop"
2019-04-24 16:58:17 +02:00
cat /home/admin/systemd.blockchain.log | grep "ERROR" | tail -n -2
2019-04-24 13:47:58 +02:00
echo
fi
2019-04-17 00:03:36 +01:00
if [ ${#bitcoinErrorFull} -gt 0 ]; then
2019-04-16 23:34:53 +01:00
echo "More Error Detail:"
2019-04-17 00:03:36 +01:00
echo ${bitcoinErrorFull}
2019-04-16 23:34:53 +01:00
echo
fi
2019-04-16 23:44:55 +01:00
echo "-> To start ${network}d run: sudo systemctl start ${network}d"
2019-04-16 23:47:45 +01:00
echo "-> To force Main Menu run: /home/admin/00mainMenu.sh"
2019-04-16 23:44:55 +01:00
echo "-> Use following command to debug: /home/admin/XXdebugLogs.sh"
2019-04-16 23:34:53 +01:00
echo ""
exit 1
fi
else
2019-04-17 00:03:36 +01:00
height=6
2019-04-17 00:28:18 +01:00
if [ ${#bitcoinErrorShort} -eq 0 ]; then
2019-04-17 00:31:59 +01:00
bitcoinErrorShort="Initial Startup - Please Wait"
2019-04-17 00:28:18 +01:00
fi
2019-04-24 16:42:16 +02:00
infoStr=" The ${network}d service is starting:\n ${bitcoinErrorShort}\n Login with SSH for more details:"
2019-04-16 23:34:53 +01:00
if [ "$USER" == "admin" ]; then
2019-04-17 00:44:18 +01:00
infoStr=" The ${network}d service is starting:\n ${bitcoinErrorShort}\n Please wait up to 5min ..."
2019-04-16 23:09:38 +01:00
fi
2019-04-16 22:23:06 +01:00
fi
2019-04-23 16:22:29 +02:00
# LND errors second
2019-04-17 00:26:30 +01:00
elif [ ${lndActive} -eq 0 ] || [ ${#lndErrorFull} -gt 0 ]; then
2019-04-16 22:23:06 +01:00
####################
# On LND Error
####################
2019-04-16 22:58:59 +01:00
height=5
2019-04-17 00:30:39 +01:00
width=43
2019-04-16 23:16:49 +01:00
title="Lightning Info"
2019-04-23 15:12:15 +02:00
if [ ${uptime} -gt 600 ]; then
2019-04-16 23:34:53 +01:00
infoStr=" The LND service is not running.\n Login for more details:"
if [ "$USER" == "admin" ]; then
2019-04-24 16:59:28 +02:00
clear
2019-04-16 23:34:53 +01:00
echo ""
echo "*********************************"
echo "* The LND service is not running."
echo "*********************************"
echo "If you just started some config/setup, this might be OK."
2019-04-16 23:09:38 +01:00
echo
2019-04-24 13:47:58 +02:00
if [ ${startcountLightning} -gt 1 ]; then
echo "${startcountLightning} RESTARTS DETECTED - ${network}d might be in a error loop"
2019-04-24 16:57:15 +02:00
cat /home/admin/systemd.lightning.log | grep "ERROR" | tail -n -2
2019-04-24 13:47:58 +02:00
echo
fi
2019-04-17 00:03:36 +01:00
if [ ${#lndErrorFull} -gt 0 ]; then
2019-04-16 23:34:53 +01:00
echo "More Error Detail:"
2019-04-17 00:03:36 +01:00
echo ${lndErrorFull}
2019-04-16 23:34:53 +01:00
echo
fi
2019-04-16 23:44:55 +01:00
echo "-> To start LND run: sudo systemctl start lnd"
2019-04-16 23:47:45 +01:00
echo "-> To force Main Menu run: /home/admin/00mainMenu.sh"
2019-04-16 23:44:55 +01:00
echo "-> Use following command to debug: /home/admin/XXdebugLogs.sh"
2019-04-16 23:34:53 +01:00
echo ""
exit 1
fi
else
infoStr=" The LND service is starting.\n Login for more details:"
if [ "$USER" == "admin" ]; then
infoStr=" The LND service is starting.\n Please wait up to 5min ..."
2019-04-16 23:09:38 +01:00
fi
2019-04-16 22:23:06 +01:00
fi
2019-04-23 16:22:29 +02:00
# if LND wallet is locked
2019-04-25 00:03:49 +02:00
elif [ ${walletLocked} -gt 0 ]; then
2019-04-25 00:07:48 +02:00
height=5
width=43
2019-04-23 16:22:29 +02:00
if [ "${autoUnlock}" = "on" ]; then
2019-04-25 00:07:48 +02:00
title="Auto Unlock"
2019-04-23 16:22:29 +02:00
infoStr=" Waiting for Wallet Auto-Unlock.\n Please wait up to 5min ..."
else
2019-04-25 00:07:48 +02:00
title="Action Required"
2019-04-25 01:21:29 +02:00
infoStr=" LND WALLET IS LOCKED (${startcountLightning}) !!!\n"
2019-04-23 16:22:29 +02:00
if [ "${rtlWebinterface}" = "on" ]; then
height=6
infoStr="${infoStr} Browser: http://${localIP}:3000\n PasswordB=login / PasswordC=unlock"
else
infoStr="${infoStr} Please use SSH to unlock:"
2019-04-25 01:21:29 +02:00
fi
2019-04-25 01:03:03 +02:00
if [ ${startcountLightning} -gt 1 ]; then
height=$((height+1))
infoStr=" LND restarted - login for details.\n${infoStr}"
fi
2019-04-23 16:22:29 +02:00
fi
2019-04-16 22:23:06 +01:00
else
####################
# Sync Progress
####################
# basic dialog info
height=6
2019-04-17 00:30:39 +01:00
width=43
2019-04-16 22:24:01 +01:00
title="Node is Syncing (${scriptRuntime})"
2019-04-24 16:23:15 +02:00
actionString="Please wait - this can take some time"
2019-04-16 22:23:06 +01:00
2019-04-16 23:15:41 +01:00
# formatting progress values
if [ ${#syncProgress} -eq 0 ]; then
2019-04-25 01:03:03 +02:00
if [ ${startcountBlockchain} -lt 2 ]; then
2019-04-24 16:23:15 +02:00
syncProgress="waiting"
else
syncProgress="${startcountBlockchain} restarts"
2019-04-24 16:42:16 +02:00
actionString="Login with SSH for more details:"
2019-04-24 16:23:15 +02:00
fi
2019-04-16 23:15:41 +01:00
elif [ ${#syncProgress} -lt 6 ]; then
syncProgress=" ${syncProgress} %"
else
syncProgress="${syncProgress} %"
2019-04-16 22:23:06 +01:00
fi
2019-04-16 23:15:41 +01:00
if [ ${#scanProgress} -eq 0 ]; then
2019-04-25 01:03:03 +02:00
if [ ${startcountLightning} -lt 2 ]; then
2019-04-24 16:23:15 +02:00
scanProgress="waiting"
else
scanProgress="${startcountLightning} restarts"
2019-04-24 16:42:16 +02:00
actionString="Login with SSH for more details:"
2019-04-24 16:23:15 +02:00
fi
2019-04-16 23:15:41 +01:00
elif [ ${#scanProgress} -lt 6 ]; then
scanProgress=" ${scanProgress} %"
else
scanProgress="${scanProgress} %"
2019-04-16 22:23:06 +01:00
fi
2019-04-16 23:15:41 +01:00
# setting info string
2019-04-24 16:23:15 +02:00
infoStr=" Blockchain Progress : ${syncProgress}\n Lightning Progress : ${scanProgress}\n ${actionString}"
2019-04-16 22:23:06 +01:00
fi
# display info to user
2019-04-16 22:08:55 +01:00
dialog --title " ${title} " --backtitle "RaspiBlitz ${codeVersion} ${hostname} / ${network} / ${chain} / ${tempCelsius}°C" --infobox "${infoStr}\n ${adminStr}" ${height} ${width}