From 5c7001d8c1d2d574b28ce51e4f514826575a9c03 Mon Sep 17 00:00:00 2001 From: /geco Date: Tue, 25 Dec 2018 12:11:36 +0100 Subject: [PATCH] detect offline --- home.admin/80scanLND.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/home.admin/80scanLND.sh b/home.admin/80scanLND.sh index 6e4292fb..7b8cfa87 100755 --- a/home.admin/80scanLND.sh +++ b/home.admin/80scanLND.sh @@ -29,6 +29,10 @@ fi # if no progress info if [ ${#item} -eq 0 ]; then item="?" + + # check if offline + # https://en.wikipedia.org/wiki/1.1.1.1 + online=$(ping 1.1.1.1 -c 1 -W 2 | grep -c '1 received') fi # get total number of blocks @@ -48,7 +52,11 @@ isWaitingBlockchain=$( sudo -u bitcoin tail -n 2 /mnt/hdd/lnd/logs/${network}/${ if [ ${isWaitingBlockchain} -gt 0 ]; then isInitialChainSync=1 fi -if [ ${isInitialChainSync} -gt 0 ]; then +fi [ ${online} -eq 0 ]; then + heigh=7 + width=44 + infoStr=$(echo " Waiting INTERNET CONNECTION\n RaspiBlitz cannot ping 1.1.1.1\n Local IP is ${localip}\n Please check cables and router.") +elif [ ${isInitialChainSync} -gt 0 ]; then heigh=7 infoStr=" Waiting for final Blockchain Sync\n Progress: ${progress} %\n Please wait - this can take some time.\n ssh admin@${localip}\n Password A" if [ "$USER" = "admin" ]; then