Add proxy lifecycle shell scripts

Provide a simple way to start, stop, and inspect the host proxy without manual process management.

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

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
严浩
2026-03-08 17:15:48 +08:00
parent b18be621d3
commit 880b76f795
3 changed files with 160 additions and 0 deletions

27
stop.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/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"