feat: serveur MCP Sliding avec OAuth 2.1 partage (C8)
This commit is contained in:
+46
@@ -0,0 +1,46 @@
|
||||
#!/bin/sh
|
||||
# Watchdog Sliding — verifie le MCP (8768) et le relance s'il ne repond pas.
|
||||
# Patient : plusieurs essais avant de conclure a la mort (le NAS peut ramer
|
||||
# pendant un rendu LibreOffice — un faux positif tuerait le service en plein
|
||||
# travail). Lance par tache planifiee DSM toutes les 5 min.
|
||||
|
||||
BASE=/volume1/homes/Master/App/Sliding/python-pptx
|
||||
LOG="$BASE/watchdog.log"
|
||||
TS=$(date '+%Y-%m-%d %H:%M:%S')
|
||||
|
||||
# Verifie /health avec plusieurs essais. Retourne 0 si OK, 1 sinon.
|
||||
wait_health() {
|
||||
URL="$1"
|
||||
TRIES="$2"
|
||||
i=0
|
||||
while [ "$i" -lt "$TRIES" ]; do
|
||||
if curl -s -f -m 5 "$URL" > /dev/null 2>&1; then
|
||||
return 0
|
||||
fi
|
||||
i=$((i + 1))
|
||||
sleep 3
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
check_and_restart() {
|
||||
NAME="$1" # libelle
|
||||
URL="$2" # url health
|
||||
STARTER="$3" # script de demarrage
|
||||
|
||||
# Check patient (3 essais, ~24s) : evite les faux positifs sous charge
|
||||
if wait_health "$URL" 3; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "$TS [$NAME] KO sur $URL — relance via $STARTER" >> "$LOG"
|
||||
sh "$BASE/$STARTER"
|
||||
|
||||
if wait_health "$URL" 5; then
|
||||
echo "$TS [$NAME] relance OK" >> "$LOG"
|
||||
else
|
||||
echo "$TS [$NAME] ECHEC relance — toujours muet apres ~30s" >> "$LOG"
|
||||
fi
|
||||
}
|
||||
|
||||
check_and_restart "mcp" "http://127.0.0.1:8768/health" "start_mcp.sh"
|
||||
Reference in New Issue
Block a user