Mooncake/mooncake-integration/ollama/scripts/stack_down.sh

21 lines
869 B
Bash

#!/usr/bin/env bash
# Tear down ONLY this workspace's services. Workspace-scoped so any co-located
# environment on this machine is never touched.
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/env.sh"
# kill by recorded PIDs first
for pf in "$OMB_RUN"/llama_*.pid "$OMB_RUN"/bridged.pid "$OMB_RUN"/store_proxy.pid; do
[ -f "$pf" ] || continue
pid=$(cat "$pf" 2>/dev/null || true)
[ -n "${pid:-}" ] && kill "$pid" 2>/dev/null || true
rm -f "$pf"
done
# belt-and-suspenders: match only command lines mentioning our state/source paths
pkill -f "$OMB_RUN/bridged" 2>/dev/null || true
pkill -f "$WS/store-proxy" 2>/dev/null || true
pkill -f "slot-save-path $OMB_SLOTS" 2>/dev/null || true
# master is on our unique port
pkill -f "mooncake_master -port $OMB_MASTER_PORT" 2>/dev/null || true
rm -f "$OMB_RUN/master.pid"
echo "[stack] down (workspace-scoped)"