algN/start.sh

44 lines
1.8 KiB
Bash
Raw Normal View History

2025-08-23 10:12:26 +08:00
#!/bin/bash
current_dir=$(cd "$(dirname "$0")"; pwd)
active=$(basename "$(dirname "$current_dir")")
conda_env="alg"
echo "当前程序所在目录: $current_dir, 当前程序启动环境: $active"
if [[ "a${active}" != "adev" && "a${active}" != "atest" && "a${active}" != "aprod" ]]; then
echo "###############################################################";
echo "启动失败, 当前环境只支持dev、test、prod";
echo "环境是根据程序所在目录自动匹配的, 请检测程序路径配置是否正确!";
echo "###############################################################";
exit 1
fi
cd $current_dir
pid=`ps x | grep "/home/th/anaconda3/envs/${conda_env}/bin/python3.8" | grep -v grep | awk '{print $1}'`
if [ -n "$pid" ]; then
echo "alg进程已存在, 进程id: $pid"
kill -9 ${pid};
echo "杀掉当前alg进程, 进程号:$pid"
sleep 1
pid_1=`ps x | grep "/home/th/anaconda3/envs/${conda_env}/bin/python3.8" | grep -v grep | awk '{print $1}'`
if [ -n "$pid_1" ]; then
echo "###############################################################";
echo "杀掉alg进程失败"
echo "###############################################################";
exit 1
else
echo "杀掉alg进程成功"
fi
fi
nohup /home/th/anaconda3/envs/${conda_env}/bin/python3.8 dsp_master.py ${active} > /dev/null 2>&1 &
sleep 1
pid_end=`ps x | grep "/home/th/anaconda3/envs/${conda_env}/bin/python3.8" | grep -v grep | awk '{print $1}'`
if [ -n "$pid_end" ]; then
echo "alg启动成功, $pid_end"
else
echo "###############################################################";
echo "alg启动失败!!!!!!!!!!!!!!!!!!!!!"
echo "###############################################################";
exit 1
2025-08-23 13:53:11 +08:00
fi
# TEST -JCQ