服务器配置了好多项目,每个项目配置都不尽相同,我想在每个项目下配置一个supervisor配置文件加载的时候,读当前项目下的配置就行
thinkphp6项目配置
supervisor.conf 主文件配置,系统下载默认的那个不管,利用supervisord -c 加载对应配置
[supervisord]
logfile = /var/tmp/supervisor_brand.log
logfile_maxbytes = 50MB
logfile_backups=10
loglevel = info
pidfile = /var/tmp/supervisor_brand.pid
nodaemon = false
user = www
minfds = 1024
minprocs = 200
umask = 022
identifier = supervisor
directory = /var/tmp
nocleanup = true
childlogdir = /var/tmp
strip_ansi = false
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[unix_http_server]
file=/var/tmp/supervisor_brand.sock ; (the path to the socket file)
chmod=0700 ; socket file mode (default 0700)
;chown=nobody:nogroup ; socket file uid:gid owner
chown=www
;username=supervisor; (default is no username (open server))
;password=123123 ; (default is no password (open server))
[supervisorctl]
serverurl = unix:///var/tmp/supervisor_brand.sock
prompt = Server
[include]
files=/www/wwwroot/test1.hzshare.net/supervisor/config/*.conf
主文件创建
同级目录下创建config目录,里面是各个具体队列如demo.conf
[program:demo]
command= /usr/bin/php /www/wwwroot/test1.hzshare.net/think queue:work --queue orderJobQueue
process_name=%(program_name)s_%(process_num)02d
numprocs=2
directory=/var/tmp
umask=022
priority=999
autostart=true
autorestart=true
startsecs=10
startretries=3
exitcodes=0,2
stopsignal=TERM
stopwaitsecs=10
redirect_stderr=false
stdout_logfile=/var/tmp/supervisor_queue_demo_jobs.log
stdout_logfile_maxbytes=100MB
stdout_logfile_backups=10
stdout_capture_maxbytes=100MB
stderr_logfile=/var/tmp/supervisor_queue_demo_jobs.error.log
stderr_logfile_maxbytes=100MB
stderr_logfile_backups=10
stderr_capture_maxbytes=100MB
serverurl=AUTO
运行
##加载配置文件并启动
/usr/bin/python /usr/bin/supervisord -c /www/wwwroot/test1.hzshare.net/supervisor/supervisor.conf
##查看任务状态
/usr/bin/python /usr/bin/supervisorctl -c /www/wwwroot/test1.hzshare.net/supervisor/supervisor.conf
查看日志
##错误日志
tail -f /var/tmp/supervisor_queue_demo_jobs.error.log
##运行日志
/var/tmp/supervisor_queue_demo_jobs.log
网友评论