minimind/trainer_web/stop_web_ui.sh

24 lines
637 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#!/bin/bash
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
cd "$SCRIPT_DIR"
if [ -f "train_web_ui.pid" ]; then
pid=$(cat "train_web_ui.pid")
if ps -p "$pid" > /dev/null 2>&1; then
echo "正在停止 Web UI 服务 (PID: $pid)"
kill "$pid"
sleep 2
# 检查是否成功停止
if ps -p "$pid" > /dev/null 2>&1; then
echo "强制停止服务..."
kill -9 "$pid"
fi
echo "服务已停止"
else
echo "服务未运行,但存在PID文件,已删除"
rm "train_web_ui.pid"
fi
else
echo "服务未运行(未找到PID文件)"
fi