31 lines
785 B
Bash
Executable File
31 lines
785 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
port="${PORT:-43210}"
|
|
data_dir="${BOSS_DATA_DIR:-.boss-data}"
|
|
pid_file="${BOSS_PID_FILE:-$data_dir/server.pid}"
|
|
log_file="${BOSS_LOG_FILE:-$data_dir/server.log}"
|
|
base_path="${BOSS_BASE_PATH:-}"
|
|
if [[ -n "$base_path" && "$base_path" != /* ]]; then
|
|
base_path="/$base_path"
|
|
fi
|
|
base_path="${base_path%/}"
|
|
health_url="http://127.0.0.1:${port}${base_path}/api/health"
|
|
|
|
if [[ -f "$pid_file" ]]; then
|
|
pid="$(cat "$pid_file")"
|
|
if [[ -n "$pid" ]] && kill -0 "$pid" 2>/dev/null; then
|
|
echo "Boss process running with PID $pid"
|
|
else
|
|
echo "Boss PID file exists but process is not running."
|
|
fi
|
|
else
|
|
echo "Boss process is not running."
|
|
fi
|
|
|
|
echo "---"
|
|
curl -fsS "$health_url" || true
|
|
echo
|
|
echo "---"
|
|
tail -n 40 "$log_file" 2>/dev/null || true
|