Files
2025-10-07 15:58:15 +08:00

44 lines
1.4 KiB
Bash
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.

bash -c '
set -e # 脚本出错即退出
echo "[1] 准备解压目录"
mkdir -p /data/webapps/yunxiao_tgz/influencer-search-agent/
mkdir -p /data/webapps/influencer-search-agent/log
echo "[2] 杀掉旧进程(如果存在)"
# 使用 pgrep + grep 精准匹配脚本名,避免误杀
PID=$(pgrep -f "python -m dialogue.influencer_search" || true)
if [[ -n "$PID" ]]; then
echo "检测到旧进程 PID: $PID正在终止..."
kill -9 $PID
echo "旧进程已终止"
else
echo "没有检测到旧进程"
fi
echo "[3] 解压部署包"
rm -rf /data/webapps/influencer-search-agent/* # 清空原文件,确保干净部署
tar zxvf /data/webapps/yunxiao_tgz/influencer-search-agent/influencer-search-agent.tgz -C /data/webapps/influencer-search-agent/
cd /data/webapps/influencer-search-agent
echo "当前路径: $(pwd)"
echo "[4] 激活 Conda 环境"
source /root/miniconda3/etc/profile.d/conda.sh
conda activate py312
echo "[5] 安装依赖"
python --version
echo "Python 路径: $(which python)"
echo "Python 版本: $(python --version)"
pip install -r requirements.txt
echo "依赖检查安装结束"
echo "[6] 启动进程"
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
nohup env PYTHONPATH=/data/webapps/influencer-search-agent APP_ENV=test \
python -m dialogue.influencer_search > /data/webapps/influencer-search-agent/log/influencer-search_${TIMESTAMP}.log 2>&1 &
echo "[7] 启动命令结束 ✅"
'