start_server.sh 628 B

123456789101112131415161718192021
  1. #!/bin/bash
  2. # 创建日志文件夹
  3. if [ ! -d "log/" ];then
  4. mkdir log
  5. fi
  6. # kill掉之前的进程
  7. server_id=`ps -ef | grep server.py | grep -v "grep" | awk '{print $2}'`
  8. echo $server_id
  9. for id in $server_id
  10. do
  11. kill -9 $id
  12. echo "killed $id"
  13. done
  14. # 启动多个服务,可以设置使用不同的显卡
  15. CUDA_VISIBLE_DEVICES=0 nohup python -u server.py --host=localhost --port=8001 >> log/output1.log 2>&1 &
  16. CUDA_VISIBLE_DEVICES=0 nohup python -u server.py --host=localhost --port=8002 >> log/output2.log 2>&1 &
  17. CUDA_VISIBLE_DEVICES=0 nohup python -u server.py --host=localhost --port=8003 >> log/output3.log 2>&1 &