more thorough handling of existing Qortal instance, no backup if running/synchronized.
This commit is contained in:
parent
1429e94481
commit
5ca15d4b9f
@ -50,7 +50,23 @@ esac
|
||||
echo -e "${CYAN}⬇️ Downloading Qortal Core...${NC}"
|
||||
cd "$HOME"
|
||||
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
|
||||
STATUS_JSON=$(curl -s http://localhost:12391/admin/status)
|
||||
|
||||
IS_SYNCING=$(echo "$STATUS_JSON" | jq -r '.isSynchronizing')
|
||||
SYNC_PERCENT=$(echo "$STATUS_JSON" | jq -r '.syncPercent')
|
||||
|
||||
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
|
||||
@ -62,6 +78,7 @@ if [ -d "$HOME/qortal" ]; then
|
||||
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
|
||||
unzip qortal.zip
|
||||
|
Loading…
x
Reference in New Issue
Block a user