#!/bin/bash # MUA - Mikes Unraid Agent # Install-Script # Wird vom Unraid-Plugin-Installer aufgerufen. set -e PLUGIN_DIR="/usr/local/plugins/mua" SERVICE_FILE="$PLUGIN_DIR/scripts/mua.service" HELPER_SRC="$PLUGIN_DIR/scripts/unraid-docker-mcp-helper.php" HELPER_DST="/usr/local/bin/unraid-docker-mcp-helper.php" echo "=== MUA Install ===" # 1. Verzeichnisse sicherstellen mkdir -p "$PLUGIN_DIR/mcp" mkdir -p "$PLUGIN_DIR/scripts" # 2. PHP-Helper installieren (Write-Operationen) if [ -f "$HELPER_SRC" ]; then cp "$HELPER_SRC" "$HELPER_DST" chmod 755 "$HELPER_DST" echo " Helper installiert: $HELPER_DST" fi # 3. systemd-Service installieren if [ -f "$SERVICE_FILE" ]; then cp "$SERVICE_FILE" /etc/systemd/system/mua.service chmod 644 /etc/systemd/system/mua.service systemctl daemon-reload echo " Service installiert: mua.service" fi # 4. Service starten + enable systemctl enable mua.service systemctl restart mua.service # 5. Health-Check sleep 2 if curl -sf "http://127.0.0.1:3002/health" > /dev/null 2>&1; then echo " Health-Check: OK" echo "=== MUA installiert und läuft auf Port 3002 ===" echo " Endpunkt: http://$(hostname -I | awk '{print $1}'):3002/mcp" else echo " WARNUNG: Health-Check fehlgeschlagen" echo " Service-Status:" systemctl status mua.service --no-pager || true exit 1 fi