Files
严浩 f90673cb3a Reorganize host runtime files
Move the host-only proxy entrypoints into a dedicated directory so it is obvious which files run on the host.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-03-08 17:51:12 +08:00

28 lines
519 B
Bash
Executable File

#!/bin/sh
set -eu
script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
pid_file="$script_dir/state/server.pid"
if [ ! -f "$pid_file" ]; then
printf 'Proxy is not running\n'
exit 0
fi
pid=$(cat "$pid_file" 2>/dev/null || true)
if [ -z "${pid:-}" ]; then
rm -f "$pid_file"
printf 'Stale pid file removed\n'
exit 0
fi
if kill -0 "$pid" 2>/dev/null; then
kill "$pid"
printf 'Stopped proxy pid=%s\n' "$pid"
else
printf 'Proxy process was not running, removing stale pid file\n'
fi
rm -f "$pid_file"