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

相关推荐
ICscholar1 天前
ExaDigiT/RAPS
linux·服务器·ubuntu·系统架构·运维开发
sim20201 天前
systemctl isolate graphical.target命令不能随便敲
linux·mysql
薛定谔的猫19821 天前
RAG(二)基于 LangChain+FAISS + 通义千问搭建轻量级 RAG 检索增强生成系统
运维·服务器·langchain
档案宝档案管理1 天前
档案宝自动化档案管理,从采集、整理到归档、利用,一步到位
大数据·数据库·人工智能·档案·档案管理
米高梅狮子1 天前
4. Linux 进程调度管理
linux·运维·服务器
C_心欲无痕1 天前
浏览器缓存: IndexDB
前端·数据库·缓存·oracle
lkbhua莱克瓦241 天前
进阶-索引3-性能分析
开发语言·数据库·笔记·mysql·索引·性能分析
剑来.1 天前
事务没提交,数据库为什么会越来越慢?
数据库·oracle
IT教程资源C1 天前
(N-089)基于springboot网上订餐系统
mysql·springboot订餐系统
IT教程资源D1 天前
[N_083]基于springboot毕业设计管理系统
mysql·springboot毕业设计