公司动态
supervisor 使用介绍
使用技巧apt-get install supervisor/etc/supervisor/conf.dcat /etc/supervisor/conf.d/filebeat.conf[program:filebeat]directory/data/filebeatcommand/data/filebeat/filebeat -c /data/filebeat/filebeat.yml;userledou00autorestarttrueredirect_stderrtruestdout_logfile/data/log/supervisord/filebeat.logmkdir -p /data/log/supervisordchmod -R 777 /data/log/supervisord*#nginxsupervisorctl updatesupervisorctl statussupervisorctl restart nginxsvr启动 supervisor 服务/etc/init.d/supervisor start服务名filebeat查看单个任务状态: supervisorctl status 服务名supervisorctl start 服务名supervisorctl stop 服务名supervisorctl restart 服务名supervisorctl update#supervisorctl updatefilebeat: added process groupsupervisorctl start filebeatfilebeat: started#添加模块守护进程 php /data/wwwroot/fanbook-service-http-api/cmd/LogCenterController.php consume1.进入目录 /etc/supervisor/conf.d2.编辑配置文件 vi LogCenterController.conf user 指定用户运行程序[program:LogCenterController]directory/data/wwwroot/fanbook-service-http-api/cmdcommandphp /data/wwwroot/fanbook-service-http-api/cmd/LogCenterController.php consumeuserubuntuautorestarttrueredirect_stderrtruestdout_logfile/data/log/supervisord/LogCenterController.log4.更新服务默认是所有supervisorctl updatefilebeat: stoppedfilebeat: updated process groupLogCenterController: added process group更新指定服务supervisorctl update LogCenterControllerLogCenterController: stoppedLogCenterController: updated process group5.检查状态supervisorctl statussupervisorctl status LogCenterController6.启动服务supervisorctl start LogCenterController#Supervisor只能管理非daemon的进程也就是说Supervisor不能管理守护进程#nginx 守护提示端口占用#关闭 daemon offcat /etc/supervisor/conf.d/nginxsvr.conf[program:nginxsvr]directory/usr/local/nginx;command/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.confcommand/usr/local/nginx/sbin/nginx -g daemon off;;userledou00autorestarttrueredirect_stderrtruestdout_logfile/data/log/supervisord/nginxsvr.log#错误supervisorctl statuspkg_resources.DistributionNotFound: The supervisor3.2.0 distribution was not found and is required by the application是python版本引起的编辑/usr/bin/supervisord /usr/bin/supervisorctl 将#!/usr/bin/python修改为#!/usr/bin/python2即可