zoukankan      html  css  js  c++  java
  • centos7 启动python后端服务与停止服务的sh脚本

    centos7 启动python后端服务与停止服务

    分别在工程目录下新建启动脚本和停止脚本。

    1、启动服务脚本

    start_srv.sh:

    python3 start_srv.py
    

    运行 nohup ./start_srv.sh & 以守护进程的方式启动这个服务。

    2、停止服务脚本

    stop_srv.sh:

    sp_pid=`ps -ef | grep start_srv | grep -v grep | awk '{print $2}'`
    
    if [ -z "$sp_pid" ];
    
    then
    
     echo "[ not find start_srv pid ]"
    
    else
    
     echo "find result: $sp_pid "
    
     kill -9 $sp_pid
    
    fi
    

    运行 ./stop_srv.sh 停止这个服务。

    参考:https://www.cnblogs.com/zeng1994/p/13a2c5a28e55dd3abc2c75a4fb80371a.html

    以上。

  • 相关阅读:
    20200816
    20200815
    20200813
    20200811
    20200810
    20200806
    20200804
    20200803
    20200802
    20200801
  • 原文地址:https://www.cnblogs.com/lovebkj/p/14044879.html
Copyright © 2011-2022 走看看