• 杀掉进程但是fastapi程序还在运行


    两个脚本,一个运行fastapi服务,一个重启服务:

    在这里插入图片描述

    启动服务先:

    在这里插入图片描述

    在这里插入图片描述

    发现问题,杀掉 server.sh 后,依旧有:

    在这里插入图片描述
    不知道为什么会出现这个,直接kill吧:

    server.sh:

    #!/bin/bash
    
    parpath=/root/autodl-tmp/wgs/wav2motion/wav2motion
    cd $parpath
    
    #python -W ignore ./server.py \
    /root/miniconda3/bin/python ./server.py \
                                --data_root $parpath \
                                --speaker2id_path ./weights/speaker2id.json \
                                --speaker_static_path ./weights/speaker_static.pkl \
                                --face_model_path ./weights/all_face.ckpt \
                                --Wav2Vec2Model_path ./weights/wav2vec2-xlsr-53-espeak-cv-ft \
                                --body_vq_path ./weights/all_vq_best.ckpt \
                                --body_pixel_path ./weights/all_pixel_best.ckpt \
                                --device 'cuda:0' \
                                --use_map_location 'cuda:0' \
                                --app_name 'server:app' \
                                --host '127.0.0.1' \
                                --port 6006 \
                                --reload True >>./log/server.log 2>>./log/server.err
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20

    cron_server.sh:

    #!/bin/bash
    
    serverpath=/root/autodl-tmp/wgs/wav2motion/wav2motion/dk/server.sh
    
    ServerName1="server.sh"
    ServerName2="server.py"
    ServerName3="multiprocessing.resource_tracker"
    ServerName4="multiprocessing.spawn"
    
    function start() {
      bash $serverpath
    }
    
    function stop() {
    
      PIDS1=$(ps aux | grep "$ServerName1" | grep -v grep | awk '{print $2}')
      PIDS2=$(ps aux | grep "$ServerName2" | grep -v grep | awk '{print $2}')
      PIDS3=$(ps aux | grep "$ServerName3" | grep -v grep | awk '{print $2}')
      PIDS4=$(ps aux | grep "$ServerName4" | grep -v grep | awk '{print $2}')
    
      echo ${PIDS1} ${PIDS2} ${PIDS3} ${PIDS4}
    
      for pid in ${PIDS1} ${PIDS2} ${PIDS3} ${PIDS4}; do
        echo $pid
        kill -9 $pid
      done
    
    }
    
    function restart() {
      stop
      sleep 2
      start
    }
    
    case $1 in
        start)
        start;;
        stop)
        stop;;
        restart)
        restart;;
        *)
    esac
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
  • 相关阅读:
    老版本kafka查询topic消费情况(python查询)
    异步FIFO设计的仿真与综合技术(3)
    #define的使用
    【PTA】浙江大学计算机与软件学院2019年考研复试上机自测
    校园网升级改造怎么做
    备战秋招,LeetCode算法大总结,啃下这块硬骨头
    【学习笔记】Redis的持久化
    安卓/iOS/Linux系统影音边下边播P2P传输解决方案
    SpringBatch reader详解
    Java毕业设计-基于SpringBoot的租房网站的设计与实现
  • 原文地址:https://blog.csdn.net/qq_42363032/article/details/133357680