From 0803b942343731aba736f027f0e60ba45f384872 Mon Sep 17 00:00:00 2001 From: crowetic Date: Wed, 5 Feb 2025 18:05:01 -0800 Subject: [PATCH] updated start again --- start-qortal.sh | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/start-qortal.sh b/start-qortal.sh index 72d5abd..0ef63b5 100644 --- a/start-qortal.sh +++ b/start-qortal.sh @@ -1,8 +1,14 @@ #!/bin/bash +# Define color codes for output +RED='\033[0;31m' +NC='\033[0m' # No color + + # Check if Qortal is running QORTAL_RUNNING=$(pgrep -f 'java.*qortal' > /dev/null && echo 1 || echo 0) GUI_START="${HOME}/.config/autostart/start-qortal.desktop" +QORTAL_LOG="${HOME}/qortal/qortal.log" if [[ -f "$GUI_START" ]]; then echo "Qortal is set to start via GUI. Checking if it is running..." @@ -16,7 +22,12 @@ if [[ -f "$GUI_START" ]]; then echo "Qortal is running and responding. Exiting..." exit 0 else - echo "Qortal is running but not responding. Restarting..." + echo "Qortal is running but not responding. Checking for bootstrapping..." + if tail -n 5 "$QORTAL_LOG" | grep -Ei 'bootstrap|bootstrapping' > /dev/null; then + echo -e "${RED}Node seems to be bootstrapping, assuming it is fine, exiting...${NC}" + exit 0 + fi + echo "Qortal is not bootstrapping. Restarting..." killall -9 java sleep 5 fi @@ -63,7 +74,12 @@ else echo "Qortal is responding. Exiting..." exit 0 else - echo "Qortal is running but unresponsive. Restarting..." + echo "Qortal is running but unresponsive. Checking for bootstrapping..." + if tail -n 5 "$QORTAL_LOG" | grep -Ei 'bootstrap|bootstrapping' > /dev/null; then + echo -e "${RED}Node seems to be bootstrapping, assuming it is operational... exiting...${NC}" + exit 0 + fi + echo "Qortal is not bootstrapping. Restarting..." killall -9 java sleep 5 fi