#!/bin/bash # Läuft AUF srv04 als Benutzer stephan (ohne sudo). Testinstanz für die Kernprüfung (#1263). # Aufruf: bash remote.sh prepare|start|sched|stop|clean # Alles liegt unter /tmp/nexus-kern (tmpfs). Die Produktion (nexus.service, Port 8080) wird nicht angefasst. set -u DIR=/tmp/nexus-kern N="$DIR/bin/nexus" CFG="$DIR/config.toml" G=/srv/models/gguf S=/home/svc-scotty/.local/share/strata/install case "${1:-}" in prepare) mkdir -p "$DIR/data"; chmod 700 "$DIR" sed "s|@DIR@|$DIR|g" "$DIR/config.toml.in" > "$CFG" add() { n=$1; shift; "$N" model add --name "$n" "$@" --config "$CFG" 2>&1 | tail -1; } add bonsai --path "$G/Bonsai-1.7B-Q1_0.gguf" --gpus 0 --context 4096 add darkidol --path "$G/DarkIdol-Llama-3.1-8B-Instruct-1.2-Uncensored-Q6_K.gguf" --gpus 0 --context 4096 add erebus --path "$G/Erebus-RP-Engine-26B-A4B.Q4_K_M.gguf" --gpus 0,1 --context 4096 add gemory --path "$G/Gemory-26B-A4B-Q4_K_M.gguf" --gpus 0,1 --context 4096 add multiverse --path "$G/M-MOE-4X7B-Dark-MultiVerse-UC-E32-24B-D_AU-Q4_k_m.gguf" --gpus 0,1 --context 4096 add cydonia --path "$G/TheDrummer_Cydonia-24B-v4.3-Q4_K_M.gguf" --gpus 0,1 --context 4096 add painted --path "$G/zerofata_MS3.2-PaintedFantasy-v3-24B-Q4_K_M.gguf" --gpus 0,1 --context 4096 add qwen36 --path "$G/models/qwen36-UD-Q4_K_XL/Qwen3.6-35B-A3B-UD-Q4_K_XL.gguf" --gpus 0,1 --context 4096 add bge-m3 --path "$G/bge-m3-q8_0.gguf" --gpus 0 --embeddings --pooling cls for t in qwen3:0.6b qwen3:1.7b llama3.2:3b gemma3:4b; do add "ollama-${t//:/-}" --engine ollama --tag "$t" --gpus 0; done add maya --engine maya --maya-config /srv/apps/maya/maya-maya-xs-iq1_s.json --gpus 0,1 for s in iq3_s q2_0 qwen36-ud-q4_k_xl; do add "strata-$s" --engine strata --strata-config "$S/strata-$s.json" --gpus 0,1; done umask 077 "$N" key create --name kern --metrics --max-priority high --config "$CFG" | grep -E '^nx[A-Za-z0-9_-]{8,}|^[A-Za-z0-9_-]{24,}$' | head -1 > "$DIR/key" echo "Key-Datei: $(wc -c < "$DIR/key") Byte" "$N" model list --config "$CFG" ;; start) setsid nohup "$N" serve --config "$CFG" > "$DIR/serve.log" 2>&1 < /dev/null & echo $! > "$DIR/nexus.pid" curl -s --retry 10 --retry-delay 1 --retry-connrefused http://127.0.0.1:18100/gateway/v1/health; echo ;; sched) # Neue [scheduler]-Werte: remote.sh sched "idle_secs = 600" "max_waiting = 4" (Instanz vorher stoppen) shift python3 -I - "$CFG" "$@" <<'PY' import re, sys p, lines = sys.argv[1], sys.argv[2:] s = open(p).read() s = re.sub(r"(?s)\[scheduler\]\n.*?\n\n", "[scheduler]\n" + "\n".join(lines) + "\n\n", s, count=1) open(p, "w").write(s) PY ;; stop) [ -f "$DIR/nexus.pid" ] && kill "$(cat "$DIR/nexus.pid")" 2>/dev/null; rm -f "$DIR/nexus.pid" ;; clean) [ -f "$DIR/nexus.pid" ] && { echo "erst stop"; exit 1; } rm -rf "$DIR" ;; *) echo "Aufruf: remote.sh prepare|start|sched|stop|clean"; exit 2 ;; esac