#!/usr/bin/env bash set -euo pipefail ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" RUN_DIR="$ROOT_DIR/.run" show_status() { local name="$1" local pid_file="$2" if [[ ! -f "$pid_file" ]]; then echo "$name: stopped" return 0 fi local pid pid="$(cat "$pid_file")" if [[ -n "$pid" ]] && kill -0 "$pid" >/dev/null 2>&1; then echo "$name: running (PID $pid)" else echo "$name: stale pid file" fi } show_status "backend" "$RUN_DIR/backend.pid" show_status "frontend" "$RUN_DIR/frontend.pid"