mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-29 17:45:15 +00:00
22 lines
526 B
Bash
22 lines
526 B
Bash
#!/usr/bin/env bash
|
|
|
|
verify_gateway_port_listening() {
|
|
local port="$1"
|
|
local lsof_output=""
|
|
|
|
if ! lsof_output="$(lsof -nP -iTCP:"${port}" -sTCP:LISTEN 2>&1)"; then
|
|
if [[ -n "${lsof_output}" ]]; then
|
|
printf '%s\n' "${lsof_output}" >&2
|
|
fi
|
|
printf 'No process is listening on gateway port %s.\n' "${port}" >&2
|
|
return 1
|
|
fi
|
|
|
|
if [[ -z "${lsof_output}" ]]; then
|
|
printf 'No process is listening on gateway port %s.\n' "${port}" >&2
|
|
return 1
|
|
fi
|
|
|
|
awk 'NR <= 5 { print }' <<<"${lsof_output}"
|
|
}
|