Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

40 linhas
1.8KB

  1. #!/bin/bash
  2. current_dir=$(cd "$(dirname "$0")"; pwd)
  3. active=$(basename "$(dirname "$current_dir")")
  4. conda_env="alg"
  5. echo "当前程序所在目录: $current_dir, 当前程序启动环境: $active"
  6. if [[ "a${active}" != "adev" && "a${active}" != "atest" && "a${active}" != "aprod" ]]; then
  7. echo "###############################################################";
  8. echo "启动失败, 当前环境只支持dev、test、prod";
  9. echo "环境是根据程序所在目录自动匹配的, 请检测程序路径配置是否正确!";
  10. echo "###############################################################";
  11. exit 1
  12. fi
  13. cd $current_dir
  14. pid=`ps x | grep "/home/th/anaconda3/envs/${conda_env}/bin/python3.8" | grep -v grep | awk '{print $1}'`
  15. if [ -n "$pid" ]; then
  16. echo "alg进程已存在, 进程id: $pid"
  17. kill -9 ${pid};
  18. echo "杀掉当前alg进程, 进程号:$pid"
  19. sleep 1
  20. pid_1=`ps x | grep "/home/th/anaconda3/envs/${conda_env}/bin/python3.8" | grep -v grep | awk '{print $1}'`
  21. if [ -n "$pid_1" ]; then
  22. echo "###############################################################";
  23. echo "杀掉alg进程失败!"
  24. echo "###############################################################";
  25. exit 1
  26. else
  27. echo "杀掉alg进程成功!!"
  28. fi
  29. fi
  30. nohup /home/th/anaconda3/envs/${conda_env}/bin/python3.8 dsp_master.py ${active} > /dev/null 2>&1 &
  31. sleep 1
  32. pid_end=`ps x | grep "/home/th/anaconda3/envs/${conda_env}/bin/python3.8" | grep -v grep | awk '{print $1}'`
  33. if [ -n "$pid_end" ]; then
  34. echo "alg启动成功, $pid_end"
  35. else
  36. echo "###############################################################";
  37. echo "alg启动失败!!!!!!!!!!!!!!!!!!!!!!"
  38. echo "###############################################################";
  39. exit 1
  40. fi