auto_trade_sys/backend/restart_recommendations.sh
薇薇安 5f256daf27 feat(recommendations): 添加推荐服务管理API与前端控制功能
在后端API中新增推荐服务的状态检查、重启、停止和启动功能,确保能够有效管理推荐服务进程。同时,更新前端组件以支持推荐服务状态的显示与控制,提升用户体验。此改动为推荐服务的管理提供了更直观的操作界面与实时状态反馈。
2026-02-23 18:02:53 +08:00

23 lines
590 B
Bash
Executable File
Raw Permalink 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
# 重启推荐服务
cd "$(dirname "$0")"
# 查找 recommendations_main 进程
PID=$(ps aux | grep "trading_system.recommendations_main" | grep -v grep | awk '{print $2}')
if [ -z "$PID" ]; then
echo "未找到运行中的推荐服务,直接启动..."
./start_recommendations.sh
else
echo "找到推荐服务PID: $PID,正在重启..."
kill $PID 2>/dev/null || true
sleep 2
if ps -p $PID > /dev/null 2>&1; then
kill -9 $PID 2>/dev/null || true
sleep 1
fi
echo "正在启动新服务..."
./start_recommendations.sh
fi