centos系统supervisor配置

supervisor用来管理非daemon程序!将自动转换为daemon程序php

安装:

yum install supervisorvim

配置:

默认配置文件路径:ruby

/etc/supervisord.confrest

主要几个配置更改

1.能够经过一个http网页进行管理,这里默认都是关闭的,开启修改用户名,密码便可,记住地址默认127.0.0.1日志

[inet_http_server] ; inet (TCP) server disabled by default
port=0.0.0.0:9001 ; (ip_address:port specifier, *:port for all iface)
username=user ; (default is no username (open server))
password=123 ; (default is no password (open server))

2.修改扩展配置,默认是.ini,修改.confserver

[include]
files = supervisord.d/*.conf

3.扩展配置示例blog

vim /etc/supervisord.d/car_push.conf进程

[program:car_push]
;process_name=%(program_name)s_%(process_num)02d
;process_name=car_push;定义supervisor内部进程名称,经过这个能够启动,中止,重启
command=/usr/bin/php /home/wwwroot/project/car/artisan car:push
;跟随supervisor启动
autostart=true
;程序异常以后自动重启
autorestart=true
;启动5秒以后,没有异常当作正常启动
startsecs=5
;启动失败以后尝试重启几回
startretries=3
user=www
;启动进程数量,注意这里若是大于1,则process_name则%(program_name)s_%(process_num)02d只能这样相似指定,要否则进程名会重复
numprocs=1
redirect_stderr=true
;stdout 日志文件大小,默认 50MB
stdout_logfile_maxbytes=30MB
;stdout 日志文件备份数
stdout_logfile_backups=10
stdout_logfile=/home/wwwroot/project/car/storage/wslogs/ws.log;

 

经常使用命令

启动程序ip

supervisord -c /etc/supervisord.confci

关闭supervisor

1.关闭全部的服务,传统,能够写脚本

supervisorctl stop all

ps -aux |grep sup

kill 对应进程号

查看进程启动状态

supervisorctl status

关闭某个进程

supervisorctl stop car_push

启动/重启某个进程

supervisorctl start/restart car_push

从新加载

supervisorctl update car_push

经过网页进行管理 

经过上面配置文件中配置http服务,能够打开对应的地址端口进行网页管理

相关文章
相关标签/搜索