当前位置: 首页> 游戏> 网游 > centos7 启动python后端服务与停止服务的sh脚本

centos7 启动python后端服务与停止服务的sh脚本

时间:2025/8/12 8:40:51来源:https://blog.csdn.net/eagle89/article/details/140996569 浏览次数:0次

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" ];thenecho "[ not find start_srv pid ]"elseecho "find result: $sp_pid "kill -9 $sp_pidfi

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

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

关键字:centos7 启动python后端服务与停止服务的sh脚本

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: