Files
memind/scripts/uninstall-local-goosed-pool.sh
T
john 570ecbd1b0 feat(wechat): add WX gate evidence and v1.49 103 cutover runbook
Prioritize scheduled-task intent over page.generate for automation phrases, add run-wechat-gate-evidence.mjs for WX-01..13, and document 103 maintenance-window steps for Goose v1.49.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-10 15:01:32 +08:00

65 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# Uninstall local goosed 1.41 native launchd pool (default 18006/18007).
set -euo pipefail
PORTS="${GOOSED_NATIVE_POOL_PORTS:-18006,18007}"
LAUNCHD_DIR="${HOME}/Library/LaunchAgents"
GUI="gui/$(id -u)"
usage() {
cat <<EOF
Usage: bash scripts/uninstall-local-goosed-pool.sh [--ports 18006,18007]
Stops and removes per-port com.tkmind.local-goosed-* LaunchAgents.
Does not touch 103 production or Goose v1.49 (:18049).
EOF
}
while [[ $# -gt 0 ]]; do
case "$1" in
--ports)
PORTS="${2:?missing value for --ports}"
shift 2
;;
-h|--help)
usage
exit 0
;;
*)
echo "unknown argument: $1" >&2
usage >&2
exit 2
;;
esac
done
IFS=',' read -r -a port_list <<< "${PORTS}"
for port in "${port_list[@]}"; do
port="${port// /}"
[[ -n "${port}" ]] || continue
label="com.tkmind.local-goosed-${port}"
plist="${LAUNCHD_DIR}/${label}.plist"
launchctl bootout "${GUI}/${label}" 2>/dev/null || true
if [[ -f "${plist}" ]]; then
rm -f "${plist}"
echo "removed ${plist}"
fi
if lsof -nP -iTCP:"${port}" -sTCP:LISTEN >/dev/null 2>&1; then
lsof -ti "TCP:${port}" -sTCP:LISTEN | xargs kill -TERM 2>/dev/null || true
sleep 1
lsof -ti "TCP:${port}" -sTCP:LISTEN | xargs kill -9 2>/dev/null || true
echo "stopped listener on port ${port}"
fi
done
# Legacy single-instance label (pre per-port pool).
launchctl bootout "${GUI}/com.tkmind.local-goosed" 2>/dev/null || true
legacy_plist="${LAUNCHD_DIR}/com.tkmind.local-goosed.plist"
if [[ -f "${legacy_plist}" ]]; then
rm -f "${legacy_plist}"
echo "removed legacy plist: ${legacy_plist}"
fi
echo "[uninstall-local-goosed-pool] done; ports=${PORTS}"