3460 Mempool install check fix (#3528)

* fix mempool working detection

* #3640 change test

* add version info for electrs
This commit is contained in:
/rootzoll 2022-12-15 23:45:46 +01:00 committed by GitHub
parent 5a08729644
commit f067250979
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 13 deletions

View file

@ -29,6 +29,8 @@ if [ "$1" = "status" ]; then
echo "##### STATUS ELECTRS SERVICE"
echo "version='${ELECTRSVERSION}'"
if [ "${ElectRS}" = "on" ]; then
echo "configured=1"
else

View file

@ -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