guanghu-ice-heart/server-tools/hololake-code-channel/stop-candidate.sh
bingshuo 8485822da6 feat: add fixed enterprise Agent gate
Part 2/4 of verified local 18dfdfd: fail-closed navigation and intent gate, fixed Agent connector, loopback code-channel candidate scripts and tests.
2026-07-26 23:13:12 +08:00

23 lines
610 B
Shell
Executable file

#!/usr/bin/env bash
set -euo pipefail
readonly HLCC_ROOT="/var/lib/guanghu-enterprise-code-channel/candidates/hlcc-v16.0.1"
readonly HLCC_PID_FILE="${HLCC_ROOT}/hlcc.pid"
if [[ "$(id -un)" != "guanghu" ]]; then
echo "Refusing to stop a domestic isolated candidate as any user other than guanghu." >&2
exit 2
fi
if [[ ! -f "${HLCC_PID_FILE}" ]]; then
echo "HLCC candidate PID file does not exist."
exit 0
fi
readonly candidate_pid="$(cat "${HLCC_PID_FILE}")"
if kill -0 "${candidate_pid}" 2>/dev/null; then
kill "${candidate_pid}"
fi
rm "${HLCC_PID_FILE}"
echo "HLCC isolated candidate stopped."