shell> apt-get install supervisor
添加进程组
shell> cat /etc/supervisor/conf.d/program.conf
[program:foo_worker]
command=/usr/bin/php /www/web/foo/worker.php
directory=%(here)s
process_name=%(program_name)s_%(process_num)s
numprocs=1
numprocs_start=0
startretries=20
redirect_stderr=true
stdout_logfile=AUTO
stdout_logfile_backups=0
stdout_logfile_maxbytes=1MB
autostart=true
autorestart=true
user=www-data
更新配置
shell> supervisorctl update
查看进程状态
shell> supervisorctl status
启动进程
shell> supervisorctl start foo_worker:foo_worker_0
shell> supervisorctl start foo_worker:*
停止进程
shell> supervisorctl stop foo_worker:foo_worker_0
shell> supervisorctl stop foo_worker:*
修复 too many open files to spawn 的错误
shell> vim /etc/supervisor/supervisord.conf
[supervisord]
minfds = 65535