Files
AItst/AIMonitor/start_gui.sh
2026-02-08 14:33:45 +08:00

61 lines
1.3 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# AI监控系统 GUI启动脚本
echo "=== AI监控系统 GUI启动器 ==="
# 检查Python环境
if ! command -v python3 &> /dev/null; then
echo "错误: 未找到python3"
exit 1
fi
# 检查PyQt6是否安装
echo "检查PyQt6依赖..."
python3 -c "import PyQt6" 2>/dev/null || {
echo "正在安装PyQt6..."
pip3 install PyQt6>=6.4.0 numpy>=1.21.0
}
# 检查后端服务是否运行
echo "检查后端服务状态..."
if ! netstat -an | grep -q ":8765"; then
echo "RTSP服务未运行正在启动..."
python3 rtsp_service_ws.py &
RTSP_PID=$!
sleep 3
if ! netstat -an | grep -q ":8765"; then
echo "警告: RTSP服务启动失败GUI将无法接收数据"
fi
else
echo "✓ RTSP服务正在运行"
fi
if ! netstat -an | grep -q ":5000"; then
echo "HTTP服务未运行正在启动..."
python3 static_server.py &
HTTP_PID=$!
sleep 2
if ! netstat -an | grep -q ":5000"; then
echo "警告: HTTP服务启动失败"
fi
else
echo "✓ HTTP服务正在运行"
fi
echo ""
echo "正在启动GUI界面..."
python3 monitor_gui.py
# GUI退出后清理后台进程
if [ ! -z "$RTSP_PID" ]; then
kill $RTSP_PID 2>/dev/null
fi
if [ ! -z "$HTTP_PID" ]; then
kill $HTTP_PID 2>/dev/null
fi
echo "GUI已关闭"