Files
wevads-arsenal/repair-cycles.sh

50 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
echo "🔧 RÉPARATION DES CYCLES AUTONOMES"
echo "=================================="
# 1. Arrêter les cycles problématiques
echo -e "\n1. Arrêt des cycles actuels..."
pkill -f "weval.*cycle" 2>/dev/null
sleep 2
# 2. Vérifier les permissions
echo -e "\n2. Vérification des permissions..."
chmod 755 /opt/wevads-arsenal/public/api/*.php
chown www-data:www-data /opt/wevads-arsenal/public/api/*.php
# 3. Tester chaque endpoint
echo -e "\n3. Test des endpoints API..."
ENDPOINTS=(
"weval-mind-interface-fixed.php"
"auto-surgeon-fixed.php"
"weval-mind-core-fixed.php"
"weval-mind-core-stable.php"
)
for endpoint in "${ENDPOINTS[@]}"; do
echo -n "$endpoint : "
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" "http://localhost:5890/api/$endpoint")
if [[ "$RESPONSE" == "200" ]]; then
echo "✅ OK ($RESPONSE)"
else
echo "❌ ERREUR ($RESPONSE)"
# Réparer le fichier
cp "/opt/wevads-arsenal/public/api/weval-mind-core-stable.php" \
"/opt/wevads-arsenal/public/api/$endpoint" 2>/dev/null
fi
done
# 4. Redémarrer les services
echo -e "\n4. Redémarrage des services..."
systemctl restart apache2 2>/dev/null
systemctl restart postgresql 2>/dev/null
# 5. Lancer un test de cycle
echo -e "\n5. Test d'un cycle autonome..."
curl -s "http://localhost:5890/api/weval-mind-core-stable.php?action=autonomous_cycle" | \
jq '.cycle_id, .status, .summary.issues_detected' 2>/dev/null || \
echo " ⚠️ jq non disponible, vérifiez manuellement"
echo -e "\n✅ RÉPARATION TERMINÉE"