open_notebook/scripts/start_services.sh
dschlueter 7838863dbf Add README.md, BEDIENUNGSANLEITUNG.md, and setup/start scripts
README.md gives the precise, reproducible install path (tested the two
scripts against the live instance - both idempotent, correctly detect
already-registered credentials/models). BEDIENUNGSANLEITUNG.md covers daily
usage: notebooks/sources, the three chat context modes (and why "nur
Erkenntnisse" needs a transformation run first), podcasts, voice cloning,
and troubleshooting for the issues actually hit during setup (num_ctx
truncation, embedding GPU contention, ufw).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-10 23:50:58 +02:00

31 lines
1.1 KiB
Bash
Executable file

#!/usr/bin/env bash
# Startet die lokalen TTS/STT-Wrapper-Server (services/tts_server.py,
# services/stt_server.py) als Hintergrundprozesse auf GPU 2. Überspringt
# einen Service, falls er unter seinem Port bereits antwortet.
set -euo pipefail
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../services" && pwd)"
mkdir -p "$DIR/logs"
cd "$DIR"
start_if_needed() {
local name="$1" port="$2" cmd="$3"
if curl -sf -m 2 "http://127.0.0.1:${port}/health" >/dev/null 2>&1; then
echo "$name läuft bereits auf Port $port"
return
fi
echo "Starte $name auf Port $port..."
eval "$cmd"
disown
for _ in $(seq 1 15); do
curl -sf -m 2 "http://127.0.0.1:${port}/health" >/dev/null 2>&1 && { echo "$name ist bereit."; return; }
sleep 2
done
echo "WARNUNG: $name antwortet nach 30s nicht auf /health — siehe logs/${name}.log" >&2
}
start_if_needed "tts" 8901 \
'CUDA_VISIBLE_DEVICES=2 TTS_PORT=8901 nohup ~/miniforge3/envs/chatterbox/bin/python tts_server.py > logs/tts_server.log 2>&1 &'
start_if_needed "stt" 8902 \
'CUDA_VISIBLE_DEVICES=2 STT_PORT=8902 nohup python3 stt_server.py > logs/stt_server.log 2>&1 &'