Spaces:
Runtime error
Runtime error
File size: 728 Bytes
a753e74 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | #!/usr/bin/env bash
set -euo pipefail
source "$(dirname "${BASH_SOURCE[0]}")/_common.sh"
stop_one() {
local name="$1" pidfile="$2"
if pid_alive "$pidfile"; then
local pid; pid="$(cat "$pidfile")"
kill "$pid" 2>/dev/null || true
# give it a moment, then force if needed
for _ in $(seq 1 10); do kill -0 "$pid" 2>/dev/null || break; sleep 0.3; done
if kill -0 "$pid" 2>/dev/null; then kill -9 "$pid" 2>/dev/null || true; fi
c_green "Stopped $name (pid $pid)."
elif [ -f "$pidfile" ]; then
c_yellow "$name not running (stale pid file removed)."
else
c_dim "$name not running."
fi
rm -f "$pidfile"
}
stop_one "backend" "$BACKEND_PID"
stop_one "frontend" "$FRONTEND_PID"
c_green "Done."
|