Centos7安装supervisor守护进程

tech2025-07-10  3

安装supervisor守护进程

安装supervisor

yum install supervisor

安装好之后,启动supervisor

supervisord -c /etc/supervisord.conf

配置守护进程文件, vim 打开 /etc./supervisord.conf ![配置守护进程文件](https://img-blog.csdnimg.cn/20200904103607212.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzA3NzU2MA==,size_16,color_FFFFFF,t_70#pic_center

配置守护进程文件 进入/etc/supervisord.d文件夹下进行配置文件

[program:test] ;#test 为程序的名称 command=python test.py ;需要执行的命令 directory=/home ;命令执行的目录 #environment=ASPNETCORE__ENVIRONMENT=Production #环境变量 #user=root #用户 stopsignal=INT autorestart=true ;#是否自动重启 startsecs=3 ;#自动重启时间间隔(s) stderr_logfile=/var/log/ossoffical.err.log ;错误日志文件 stdout_logfile=/var/log/ossoffical.out.log ;输出日志文件

编写完成之后update supervisor

supervisorctl update

常用命令

$ supervisorctl status 查看当前运行的状态 $ supervisorctl stop 关闭 $ supervisorctl start 程序名 $ supervisorctl restart 程序名 $ supervisorctl reread #重新加载所有文件 $ supervisorctl update # 只加载进行更新的问题件
最新回复(0)