d1d356f8
tangwang
θζ¬δΌε
|
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#!/bin/bash
#
# Stop Reranker Service
#
set -e
cd "$(dirname "$0")/.."
PID_FILE="logs/reranker.pid"
RERANKER_PORT="${RERANKER_PORT:-6007}"
echo "========================================"
echo "Stopping Reranker Service"
echo "========================================"
if [ -f "${PID_FILE}" ]; then
PID="$(cat "${PID_FILE}" 2>/dev/null || true)"
if [ -n "${PID}" ] && kill -0 "${PID}" 2>/dev/null; then
echo "Stopping PID from file: ${PID}"
kill -TERM "${PID}" 2>/dev/null || true
sleep 1
if kill -0 "${PID}" 2>/dev/null; then
kill -KILL "${PID}" 2>/dev/null || true
fi
fi
rm -f "${PID_FILE}"
fi
PORT_PIDS="$(lsof -ti:${RERANKER_PORT} 2>/dev/null || true)"
if [ -n "${PORT_PIDS}" ]; then
echo "Stopping process on port ${RERANKER_PORT}: ${PORT_PIDS}"
for PID in ${PORT_PIDS}; do
kill -TERM "${PID}" 2>/dev/null || true
done
sleep 1
PORT_PIDS="$(lsof -ti:${RERANKER_PORT} 2>/dev/null || true)"
for PID in ${PORT_PIDS}; do
kill -KILL "${PID}" 2>/dev/null || true
done
fi
echo "Reranker service stopped."
|