From b6dd3953a676147e8860585eae76973504da7028 Mon Sep 17 00:00:00 2001 From: Christian Rotzoll Date: Tue, 16 Apr 2019 23:34:53 +0100 Subject: [PATCH] Add startup grace time --- home.admin/80scanLND.sh | 86 +++++++++++-------- home.admin/config.scripts/blitz.statusscan.sh | 4 + 2 files changed, 54 insertions(+), 36 deletions(-) diff --git a/home.admin/80scanLND.sh b/home.admin/80scanLND.sh index 683439c..72e814b 100755 --- a/home.admin/80scanLND.sh +++ b/home.admin/80scanLND.sh @@ -20,26 +20,33 @@ if [ ${bitcoinActive} -eq 0 ]; then height=6 width=42 title="Blockchain Info" - infoStr=" The ${network}d service is not running.\n Login for more details:" - if [ "$USER" == "admin" ]; then - echo "" - echo "*****************************************" - echo "* The ${network}d service is not running." - echo "*****************************************" - echo "If you just started some config/setup, this might be OK." - echo - if [ ${#bitcoinError} -gt 0 ]; then - echo "More Error Detail:" - echo ${bitcoinError} + if [ ${uptime} -gt 300 ]; then + infoStr=" The ${network}d service is not running.\n Login for more details:" + if [ "$USER" == "admin" ]; then + echo "" + echo "*****************************************" + echo "* The ${network}d service is not running." + echo "*****************************************" + echo "If you just started some config/setup, this might be OK." echo + if [ ${#bitcoinError} -gt 0 ]; then + echo "More Error Detail:" + echo ${bitcoinError} + echo + fi + echo "Use following command start ${network}d:" + echo "sudo systemctl start ${network}d" + echo + echo "Use following command to debug:" + echo "/home/admin/XXdebugLogs.sh" + echo "" + exit 1 + fi + else + infoStr=" The ${network}d service is starting.\n Login for more details:" + if [ "$USER" == "admin" ]; then + infoStr=" The ${network}d service is starting.\n Please wait up to 5min ..." fi - echo "Use following command start ${network}d:" - echo "sudo systemctl start ${network}d" - echo - echo "Use following command to debug:" - echo "/home/admin/XXdebugLogs.sh" - echo "" - exit 1 fi elif [ ${lndActive} -eq 0 ]; then @@ -51,26 +58,33 @@ elif [ ${lndActive} -eq 0 ]; then height=5 width=42 title="Lightning Info" - infoStr=" The lnd service is not running.\n Login for more details:" - if [ "$USER" == "admin" ]; then - echo "" - echo "*********************************" - echo "* The LND service is not running." - echo "*********************************" - echo "If you just started some config/setup, this might be OK." - echo - if [ ${#lndError} -gt 0 ]; then - echo "More Error Detail:" - echo ${lndError} + if [ ${uptime} -gt 300 ]; then + infoStr=" The LND service is not running.\n Login for more details:" + if [ "$USER" == "admin" ]; then + echo "" + echo "*********************************" + echo "* The LND service is not running." + echo "*********************************" + echo "If you just started some config/setup, this might be OK." echo + if [ ${#lndError} -gt 0 ]; then + echo "More Error Detail:" + echo ${lndError} + echo + fi + echo "Use following command start lnd:" + echo "sudo systemctl start lnd" + echo + echo "Use following command to debug:" + echo "/home/admin/XXdebugLogs.sh" + 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 ..." fi - echo "Use following command start lnd:" - echo "sudo systemctl start lnd" - echo - echo "Use following command to debug:" - echo "/home/admin/XXdebugLogs.sh" - echo "" - exit 1 fi else diff --git a/home.admin/config.scripts/blitz.statusscan.sh b/home.admin/config.scripts/blitz.statusscan.sh index 0f88a3b..b3951c2 100644 --- a/home.admin/config.scripts/blitz.statusscan.sh +++ b/home.admin/config.scripts/blitz.statusscan.sh @@ -24,6 +24,10 @@ echo "localIP='${localip}'" tempC=$(echo "scale=1; $(cat /sys/class/thermal/thermal_zone0/temp)/1000" | bc) echo "tempCelsius='${tempC}'" +# uptime in seconds +uptime=$(awk '{printf("%d\n",$1 + 0.5)}' /proc/uptime) +echo "uptime=${uptime}" + # is bitcoind running bitcoinRunning=$(systemctl status ${network}d.service 2>/dev/null | grep -c running) echo "bitcoinActive=${bitcoinRunning}"