From 9ad3cbe0d794889ab59ebb02ec2a49f562d72a40 Mon Sep 17 00:00:00 2001 From: BeauTroll <-> Date: Wed, 17 Dec 2025 05:51:12 +0100 Subject: [PATCH] Fix docker compose ps command usage across scripts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace deprecated `docker compose ps | grep` patterns with the more reliable `docker compose ps --status running --services | grep` command. This ensures consistent container status checking across backup, restore, and update scripts. Also fix regex pattern in update.sh for French "oui" validation. đŸ€– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- scripts/backup.sh | 4 +++- scripts/restore.sh | 2 +- scripts/update.sh | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/backup.sh b/scripts/backup.sh index 789f90e..191b530 100755 --- a/scripts/backup.sh +++ b/scripts/backup.sh @@ -89,8 +89,10 @@ log "${BLUE}[$(date '+%Y-%m-%d %H:%M:%S')] DĂ©but de la sauvegarde${NC}" log "Backup name: $BACKUP_NAME" # VĂ©rifier que les conteneurs sont en cours d'exĂ©cution -if ! docker compose ps | grep -q 'gitea.*running'; then +if ! docker compose ps --status running --services | grep -q '^gitea$'; then log "${RED}Erreur: Le conteneur Gitea n'est pas en cours d'exĂ©cution${NC}" + log "État actuel:" + docker compose ps exit 1 fi diff --git a/scripts/restore.sh b/scripts/restore.sh index 2bf1260..20b214b 100755 --- a/scripts/restore.sh +++ b/scripts/restore.sh @@ -270,7 +270,7 @@ log "Attente du dĂ©marrage complet..." sleep 10 MAX_TRIES=30 COUNTER=0 -until docker compose ps | grep -q 'gitea.*running'; do +until docker compose ps --status running --services | grep -q '^gitea$'; do COUNTER=$((COUNTER + 1)) if [ $COUNTER -gt $MAX_TRIES ]; then log "${YELLOW}Avertissement: Gitea met du temps Ă  dĂ©marrer${NC}" diff --git a/scripts/update.sh b/scripts/update.sh index 58bbc43..7146991 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -59,16 +59,16 @@ log "" # Sauvegarder la version actuelle CURRENT_VERSION="" -if docker compose ps | grep -q 'gitea.*running'; then +if docker compose ps --status running --services | grep -q '^gitea$'; then CURRENT_VERSION=$(docker compose exec -T gitea gitea --version 2>/dev/null | head -n 1 || echo "Inconnue") log "Version actuelle: $CURRENT_VERSION" fi # VĂ©rifier que les services tournent -if ! docker compose ps | grep -q 'gitea.*running'; then +if ! docker compose ps --status running --services | grep -q '^gitea$'; then log "${YELLOW}Avertissement: Gitea ne semble pas ĂȘtre en cours d'exĂ©cution${NC}" read -p "Continuer quand mĂȘme? (oui/non) " -r - if [[ ! $REPLY =~ ^[Oo][Uu][Ii]$ ]]; then + if [[ ! $REPLY =~ ^[Oo][Uu][Ui]$ ]]; then log "Mise Ă  jour annulĂ©e par l'utilisateur." exit 0 fi