| 1234567891011121314151617181920212223 |
- #!/usr/bin/env bash
- set -euo pipefail
- PIDFILE=${PIDFILE:-server.pid}
- stop_pid() {
- local pid="$1"
- if [ -n "$pid" ] && ps -p "$pid" > /dev/null 2>&1; then
- kill "$pid" 2>/dev/null || true
- sleep 1
- ps -p "$pid" > /dev/null 2>&1 && kill -9 "$pid" 2>/dev/null || true
- fi
- }
- if [ -f "$PIDFILE" ]; then
- PID=$(cat "$PIDFILE" 2>/dev/null || true)
- stop_pid "$PID"
- rm -f "$PIDFILE"
- fi
- # Sweep up stale server processes started from this project.
- for pid in $(pgrep -f 'news_mcp\.mcp_server_fastmcp:app|uvicorn .*news_mcp\.mcp_server_fastmcp:app' || true); do
- stop_pid "$pid"
- done
|