diff --git a/restore.sh b/restore.sh index 96f13a5..59666ae 100644 --- a/restore.sh +++ b/restore.sh @@ -2,7 +2,7 @@ # ============================================================================= # /opt/windmill-restore/restore.sh # Windmill Backup Restore Worker -# Version: 1.0.22 +# Version: 1.0.23 # # Unterstützt sowohl VM (qm) als auch CT (pct) Backups. # Backup-Typ wird automatisch aus dem Backup-Pfad erkannt (vm/ oder ct/). @@ -565,10 +565,14 @@ if [[ "$BACKUP_TYPE" == "ct" ]]; then pct stop "$VM_ID_RESTORED" 2>/dev/null || true sleep 10 else - qm shutdown "$VM_ID_RESTORED" 2>/dev/null || true - sleep 30 - qm stop "$VM_ID_RESTORED" --skiplock 1 2>/dev/null || true - sleep 5 + # Graceful shutdown mit 2 Minuten Timeout, danach force-stop + qm shutdown "$VM_ID_RESTORED" --timeout 120 2>/dev/null || true + # Prüfen ob VM noch läuft → force-stop + if qm status "$VM_ID_RESTORED" 2>/dev/null | grep -q "running"; then + echo " VM läuft noch nach 120s – force stop..." + qm stop "$VM_ID_RESTORED" --skiplock 1 2>/dev/null || true + sleep 5 + fi fi echo " Gestoppt."