more thorough handling of existing Qortal instance, no backup if running/synchronized.
This commit is contained in:
parent
1429e94481
commit
5ca15d4b9f
@ -50,17 +50,34 @@ esac
|
|||||||
echo -e "${CYAN}⬇️ Downloading Qortal Core...${NC}"
|
echo -e "${CYAN}⬇️ Downloading Qortal Core...${NC}"
|
||||||
cd "$HOME"
|
cd "$HOME"
|
||||||
if [ -d "$HOME/qortal" ]; then
|
if [ -d "$HOME/qortal" ]; then
|
||||||
if pgrep -f "qortal.jar" > /dev/null && curl -s "http://localhost:12391/admin/status" | grep -q "uptime"; then
|
if pgrep -f "qortal.jar" > /dev/null && curl -s "http://localhost:12391/admin/status" | grep -q "height"; then
|
||||||
if [ -f "${HOME}/qortal/stop.sh" ]; then
|
STATUS_JSON=$(curl -s http://localhost:12391/admin/status)
|
||||||
"${HOME}/qortal/stop.sh"
|
|
||||||
else
|
IS_SYNCING=$(echo "$STATUS_JSON" | jq -r '.isSynchronizing')
|
||||||
curl -X POST "http://localhost:12391/admin/stop" -H "X-API-KEY: $(cat ${HOME}/qortal/apikey.txt)"
|
SYNC_PERCENT=$(echo "$STATUS_JSON" | jq -r '.syncPercent')
|
||||||
fi
|
|
||||||
|
echo "🛰️ Syncing: $IS_SYNCING"
|
||||||
|
echo "📊 Sync Percent: $SYNC_PERCENT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$IS_SYNCING" == "false" || "$SYNC_PERCENT" == "100" ]]; then
|
||||||
|
echo "✅ Qortal Core is fully synchronized. No Backup needed..."
|
||||||
|
BACKUP_EXECUTED=false
|
||||||
|
else
|
||||||
|
echo "⚠️ Qortal Core is not fully synced. Proceeding with update/start/etc."
|
||||||
|
|
||||||
|
if pgrep -f "qortal.jar" > /dev/null && curl -s "http://localhost:12391/admin/status" | grep -q "height"; then
|
||||||
|
if [ -f "${HOME}/qortal/stop.sh" ]; then
|
||||||
|
"${HOME}/qortal/stop.sh"
|
||||||
|
else
|
||||||
|
curl -X POST "http://localhost:12391/admin/stop" -H "X-API-KEY: $(cat ${HOME}/qortal/apikey.txt)"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
mkdir -p "$HOME/backups"
|
||||||
|
echo -e "${YELLOW}⚠️ Existing 'qortal' folder found. Backing it up...${NC}"
|
||||||
|
mv "$HOME/qortal" "$HOME/backups/qortal-$(date +%s)"
|
||||||
|
BACKUP_EXECUTED=true
|
||||||
fi
|
fi
|
||||||
mkdir -p "$HOME/backups"
|
|
||||||
echo -e "${YELLOW}⚠️ Existing 'qortal' folder found. Backing it up...${NC}"
|
|
||||||
mv "$HOME/qortal" "$HOME/backups/qortal-$(date +%s)"
|
|
||||||
BACKUP_EXECUTED=true
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
curl -LO https://github.com/Qortal/qortal/releases/latest/download/qortal.zip
|
curl -LO https://github.com/Qortal/qortal/releases/latest/download/qortal.zip
|
||||||
|
Loading…
x
Reference in New Issue
Block a user