f8e3e8ca29
Etage 1 de l'automatisation du Lint (backlog 8ETP6OyqToMR). - wrapper d'exploitation, lint_audit.py reste un moteur pur en lecture seule - tache DSM dimanche 21h00, utilisateur Master (pas root : moindre privilege, le Lint lit Trilium via ETAPI localhost) - sortie d'UNE ligne pour le mail DSM (total, bacs, dimensions, chemin rapport) - mail a chaque run (pas seulement si anomalie) : le silence serait ambigu entre 'rien a signaler' et 'la tache est morte' — anti confident-but-stale - rotation 12 rapports (~3 mois), erreur explicite si venv absent, si le Lint plante, ou si la synthese est illisible
40 lines
1.5 KiB
Bash
40 lines
1.5 KiB
Bash
#!/bin/sh
|
|
# lint_weekly.sh - Execution hebdomadaire du Lint (etage 1 : lecture seule).
|
|
# Lance par le planificateur DSM le dimanche soir, utilisateur Master.
|
|
# lint_audit.py n ecrit RIEN dans Trilium : il produit un rapport dans lint_reports/.
|
|
# Ce wrapper : execute, fait tourner les rapports, sort UNE ligne pour le mail DSM.
|
|
|
|
BASE=/volume1/homes/Master/App/Context_continuity
|
|
PY=$BASE/venv/bin/python3
|
|
REPORTS=$BASE/lint_reports
|
|
GARDER=12 # ~3 mois d historique hebdomadaire
|
|
|
|
cd $BASE || { echo "ERREUR repertoire introuvable : $BASE"; exit 1; }
|
|
[ -x "$PY" ] || { echo "ERREUR venv introuvable : $PY"; exit 1; }
|
|
|
|
SORTIE=$($PY lint_audit.py 2>&1)
|
|
CODE=$?
|
|
if [ $CODE -ne 0 ]; then
|
|
echo "ERREUR lint_audit.py a echoue (code $CODE)"
|
|
echo "$SORTIE" | tail -5
|
|
exit 1
|
|
fi
|
|
|
|
# Extraire la synthese du rapport
|
|
TOTAL=$(echo "$SORTIE" | grep '^## Synthese' | sed 's/.*: \([0-9]*\) anomalie.*/\1/')
|
|
DIMS=$(echo "$SORTIE" | grep 'Par dimension' | sed 's/.*Par dimension : //')
|
|
BACS=$(echo "$SORTIE" | grep "Par bac d'action" | sed "s/.*Par bac d'action : //")
|
|
FICHIER=$(echo "$SORTIE" | grep '^Rapport ecrit' | sed 's/^Rapport ecrit : //')
|
|
|
|
# Rotation des rapports
|
|
if [ -d "$REPORTS" ]; then
|
|
cd $REPORTS && ls -1t lint_*.txt 2>/dev/null | tail -n +$((GARDER+1)) | while read f; do rm -f "$f"; done
|
|
fi
|
|
|
|
# Une ligne pour le mail DSM (le detail est dans le fichier)
|
|
if [ -z "$TOTAL" ]; then
|
|
echo "ERREUR synthese illisible dans la sortie du Lint"
|
|
exit 1
|
|
fi
|
|
echo "LINT $TOTAL anomalie(s) | $BACS | $DIMS | rapport: $FICHIER"
|