From f067250979c305919c25a9995aac53d159a120e2 Mon Sep 17 00:00:00 2001 From: /rootzoll Date: Thu, 15 Dec 2022 23:45:46 +0100 Subject: [PATCH] 3460 Mempool install check fix (#3528) * fix mempool working detection * #3640 change test * add version info for electrs --- home.admin/config.scripts/bonus.electrs.sh | 2 ++ home.admin/config.scripts/bonus.mempool.sh | 27 +++++++++++----------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/home.admin/config.scripts/bonus.electrs.sh b/home.admin/config.scripts/bonus.electrs.sh index 2ec6f9f2b..911a0dfdb 100755 --- a/home.admin/config.scripts/bonus.electrs.sh +++ b/home.admin/config.scripts/bonus.electrs.sh @@ -29,6 +29,8 @@ if [ "$1" = "status" ]; then echo "##### STATUS ELECTRS SERVICE" + echo "version='${ELECTRSVERSION}'" + if [ "${ElectRS}" = "on" ]; then echo "configured=1" else diff --git a/home.admin/config.scripts/bonus.mempool.sh b/home.admin/config.scripts/bonus.mempool.sh index 446f565ba..c51d5ff0e 100755 --- a/home.admin/config.scripts/bonus.mempool.sh +++ b/home.admin/config.scripts/bonus.mempool.sh @@ -337,6 +337,16 @@ EOF if [ "${state}" == "ready" ]; then echo "# OK - the mempool.service is enabled, system is on ready so starting service" sudo systemctl start mempool + sleep 10 + + # check install success by testing backend + isWorking=$(sudo systemctl status mempool | grep -c "Active: active") + if [ ${isWorking} -lt 1 ]; then + # signal an error to WebUI + echo "result='mempool service not active'" + exit 1 + fi + else echo "# OK - the mempool.service is enabled, to start manually use: sudo systemctl start mempool" fi @@ -353,19 +363,10 @@ EOF /home/admin/config.scripts/tor.onion-service.sh mempool 80 4082 443 4083 fi - # check install success by testing backend - localIP=$(hostname -I | awk '{print $1}') - httpResponseCode=$(curl -s -o /dev/null -w "%{http_code}" http://${localIP}:4080/api/v1/statistics/2h) - if [ "${httpResponseCode}" != "200" ]; then - # signal an error to WebUI - echo "result='${httpResponseCode}'" - echo "# HTTP error code ${httpResponseCode} calling backend: http://${localIP}:4080/api/v1/statistics/2h" - exit 1 - else - # needed for API/WebUI as signal that install ran thru - echo "result='OK'" - exit 0 - fi + # needed for API/WebUI as signal that install ran thru + echo "result='OK'" + exit 0 + fi