Files
weval-l99/guardian-v2.sh
2026-04-15 01:38:46 +02:00

42 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# WEVAL Guardian — anti-suppression cron */5
LOG=/var/log/weval-guardian.log
DATE=$(date +"%Y-%m-%d %H:%M")
# Critical files — auto-lock + auto-restore
FILES=(
"/var/www/html/api/weval-ia-fast.php"
"/var/www/html/api/cognitive-wire.php"
"/var/www/html/weval-translate.js"
"/var/www/html/api/weval-auth-session.php"
"/var/www/html/api/weval-audit-reco.js"
"/var/www/html/wevia-cortex.html"
"/var/www/html/wevia.html"
"/var/www/html/api/weval-chatbot-api.php"
"/var/www/html/api/wevia-stream-api.php"
"/var/www/html/api/wevia-live-metrics.php"
)
for f in "${FILES[@]}"; do
if [ ! -f "$f" ]; then
echo "[$DATE] MISSING: $f — restoring from git" >> $LOG
cd /var/www/html && echo "[GUARDIAN-ALERT] MISSING: "$f" 2>/dev/null
fi
echo "[GUARDIAN-ALERT] WOULD-LOCK: "$f" 2>/dev/null
done
# Docker containers — auto-restart
for c in mirofish authentik-server searxng qdrant mattermost uptime-kuma plausible n8n twenty vaultwarden; do
STATUS=$(docker inspect -f '{{.State.Running}}' $c 2>/dev/null)
if [ "$STATUS" != "true" ]; then
docker start $c 2>/dev/null
echo "[$DATE] RESTARTED: $c" >> $LOG
fi
done
# Routes count check
ROUTES=$(grep -c "// Route" /var/www/html/api/weval-ia-fast.php 2>/dev/null)
if [ "$ROUTES" -lt 370 ]; then
echo "[$DATE] REGRESSION: Routes=$ROUTES (expected 370+)" >> $LOG
fi