supervisord

supervisor开机自启动方法

折月煮酒 提交于 2020-01-20 04:15:41
配置service类型服务 1 #!/bin/bash 2 # 3 # supervisord This scripts turns supervisord on 4 # 5 # Author: Mike McGrath <mmcgrath@redhat.com> (based off yumupdatesd) 6 # 7 # chkconfig: - 95 04 8 # 9 # description: supervisor is a process control utility. It has a web based 10 # xmlrpc interface as well as a few other nifty features. 11 # processname: supervisord 12 # config: /etc/supervisor/supervisord.conf 13 # pidfile: /var/run/supervisord.pid 14 # 15 16 # source function library 17 . /etc/rc.d/init.d/functions 18 19 RETVAL=0 20 21 start() { 22 echo -n $"Starting supervisord: " 23 daemon "/usr/local

Supervisor进程管理&开机自启

拜拜、爱过 提交于 2020-01-20 01:22:54
这几天在用supervisor管理爬虫和Flask, 每次都记不住命令,花点时间记录下。 supervisor 是一个进程管理工具,用来启动、停止、重启和监测进程。我用这个东西主要用来监测爬虫和Flask运行状况,当程序挂掉后,supervisor能够帮我重新拉起进程。 安装 安装就比较简单了,直接用Python的包管理器pip: sudo pip install supervisor 配置 先通过echo_supervisord_conf 命令生成配置文件,路径随你指定。 echo_supervisord_conf > /etc/supervisord.conf 查看配置文件,常用配置说明: ;supervisord.conf [unix_http_server] file=/tmp/supervisor.sock ; UNIX socket 文件,supervisorctl 会使用 ;chmod=0700 ; socket 文件的 mode,默认是 0700 ;chown=nobody:nogroup ; socket 文件的 owner,格式: uid:gid ;[inet_http_server] ; HTTP 服务器,提供 web 管理界面 ;port=127.0.0.1:9001 ; Web 管理后台运行的 IP 和端口,如果开放到公网,需要注意安全性

supervisor

邮差的信 提交于 2020-01-19 15:25:24
---恢复内容开始--- 1、supervisor默认路径在\tmp下面,如果服务器重启之后,缓存可能被清除,需要更改路径 /tmp/supervisor.sock 改成 /var/run/supervisor.sock, /tmp/supervisord.log 改成 /var/log/supervisor.log, /tmp/supervisord.pid 改成 /var/run/supervisor.pid https://blog.csdn.net/qq_28885149/article/details/79364685 2、修改文件夹权限到777 sudo chmod 777 /run sudo chmod 777 /var/log 3、新增sock sudo touch / var/run/supervisor.sock sudo chmod 777 / var/run/supervisor.sock 5、find / -name supervisor.sock 找到supervisor.sock这个文件,一般应该是在tmp下面 unlink /name/supervisor.sock 进行unlink 4、启动supervisor, 如果不在默认路径下,需要指定 sudo supervisord -c supervisord.conf 5、 sudo

supervisord 启动失败 Error: Another program is already listening on a port that one of our HTTP serve...

本小妞迷上赌 提交于 2020-01-19 15:24:07
Linux系统中 Supervisor 配置守护进程: 启动Supervisor 服务语句: supervisord -c /etc/supervisor/supervisord.conf 这个过程可能会失败,错误如下:    解决办法: 执行下面语句 unlink /var/run/supervisor.sock unlink /tmp/supervisor.sock 这个错误的原因就是supervisor.sock 这个文件会被系统自动删除或者其它原因不存在了,删除软连接就可以了。 supervisor.sock 生成的位置可以去 supervisor 的配置文件中找到。 来源: https://www.cnblogs.com/wmyll/p/10615051.html

解决supervisord启动问题

不羁的心 提交于 2020-01-19 15:22:51
作者:StormerX 链接:https://www.jianshu.com/p/d8901ce4712b 来源:简书 简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。 $ supervisord -c /etc/supervisor/supervisord.conf Error: Another program is already listening on a port that one of our HTTP servers is configured touse. Shut this program down first before starting supervisord. For help, use /usr/bin/supervisord -h 解决办法: unlink /var/run/supervisor.sock unlink /tmp/supervisor.sock 这个错误的原因就是supervisor.sock这个文件会被系统自动删除或者其它原因不存在了,删除软连接就可以了。 supervisor.sock生成的位置可以去supervisor的配置文件中找到。 来源: https://www.cnblogs.com/saintdingspage/p/10930507.html

supervisor守护进程工具

那年仲夏 提交于 2020-01-17 17:08:45
环境 centos7.x ### 必须需要2.7+版本python centos7 默认自带 # 需要用到easy_install命令,假如你是centos6.x,那你需要安装对应版本 python2.7.5 安装 很简单执行以下命令就能完成安装,很快 easy_install supervisor 安装完成后会生成以下命令,可以直接使用 /usr/bin/echo_supervisord_conf /usr/bin/pidproxy /usr/bin/supervisorctl /usr/bin/supervisord 使用 初始化配置 使用命令 echo_supervisord_conf ## conf.d 文件得作用为了不破坏主配置文件完整性和结构性而存在得。有点模块化得味道。不用我多介绍了吧。后续所有应用脚本全部配置在此目录下,所有配置以.conf为后缀 mkdir -p /etc/supervisor/conf.d # 此命令将配置写入supervisord.conf 这个文件 echo_supervisord_conf > /etc/supervisor/supervisord.conf 然后编辑 supercisord.conf 末尾添加如下配置,指向 conf.d 目录 [ include ] files = conf.d/*.conf 然后启动

How to subscribe to PROCESS_STATE_RUNNING events for all processes

我们两清 提交于 2020-01-15 12:31:08
问题 I'm using Supervisor's events framework to subscribe to events from processes managed by Supervisor. My event listener, processlistener.py , looks like this: import sys from supervisor.childutils import listener def write_stdout(s): sys.stdout.write(s) sys.stdout.flush() def write_stderr(s): sys.stderr.write(s) sys.stderr.flush() def main(): while True: headers, body = listener.wait(sys.stdin, sys.stdout) body = dict([pair.split(":") for pair in body.split(" ")]) write_stderr("Headers: %r\n"

django start celery daemon in production with supervisor

北战南征 提交于 2020-01-15 06:39:26
问题 I have created a conf file for supervisor inside /etc/supervisor/conf.d/myproject-celery.conf My configuration file looks like: [program:celery] command=/var/www/html/project/venv/bin/python /var/www/html/project/manage.py celeryd --loglevel=INFO environment=PYTHONPATH=/var/www/html/project directory=/var/www/html/project user=www-data numprocs=1 stdout_logfile=/var/log/celeryd.log stderr_logfile=/var/log/celeryd.log autostart=true autorestart=true startsecs=10 stopwaitsecs = 600 priority=998

nginx+uWSGI+django+virtualenv+supervisor发布web服务器

你说的曾经没有我的故事 提交于 2020-01-14 15:57:26
nginx+uWSGI+django+virtualenv+supervisor发布web服务器 导论 WSGI是Web服务器网关接口。它是一个规范,描述了Web服务器如何与Web应用程序通信,以及Web应用程序如何链接在一起以处理一个请求,(接收请求,处理请求,响应请求) 基于wsgi运行的框架有Bottle,Django,Flask,用于解析动态HTTP请求 支持WSGI的服务器 wsgiref python自带的web服务器 Gunicorn 用于linux的 python wsgi Http服务器,常用于各种django,flask结合部署服务器。 mode_wsgi 实现了Apache与wsgi应用程序的结合 uWSGI C语言开发,快速,自我修复,开发人员友好的WSGI服务器,用于Python Web应用程序的专业部署和开发。 在部署python程序web应用程序时,可以根据性能的需求,选择合适的wsgi server,不同的wsgi server区别在于并发支持上,有单线程,多进程,多线程,协程的区别,其功能还是近似,无非是请求路由,执行对应的函数,返回处理结果。 Django部署 Django的主要部署平台是 WSGI,这是用于Web服务器和应用程序的Python标准。 Django的 startproject管理命令设置一个简单的默认WSGI配置

Shutting down Docker containers via supervisor

谁说我不能喝 提交于 2020-01-12 07:09:01
问题 I'm unable to shut down Docker containers that were launched by supervisor through supervisorctl stop all . Even through supervisorctl status shows the containers are down, docker ps and ps indicate that they are in fact still running. Consulting the supervisor documentation on the action for supervisorctl stop <name> reveals that SIGTERM is sent to processes followed by SIGKILL if still running after some grace period. I tried to do this manually and found that SIGTERM sent to a docker run