Files
boss/scripts/server_status.sh
2026-03-23 13:25:56 +08:00

25 lines
607 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}"
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 "http://127.0.0.1:${port}/api/health" || true
echo
echo "---"
tail -n 40 "$log_file" 2>/dev/null || true