安装

yum install supervisor
touch /var/run/supervisor/supervisor.sock
chmod 777 /var/run/supervisor/supervisor.sock
supervisord
supervisorctl start all
supervisorctl status

配置目录:/etc/supervisor.d

基于swoft的配置

[program:user-center-gift]
process_name=%(program_name)s_%(process_num)02d
command=/usr/local/php/bin/php /home/www/userCenter/bin/swoft gift:write
autostart=true
autorestart=true
user=root
numprocs=1
redirect_stderr=true
stdout_logfile=/home/www/supervisor_user-center-gift.log [program:test]
# 设置命令在指定的目录内执行
directory=/www/go/src/gin-api
# 这里为您要管理的项目的启动命令
command=/www/go/src/gin-api/test
# 以哪个用户来运行该进程
user=root
# supervisor 启动时自动该应用
autostart=true
# 进程退出后自动重启进程
autorestart=true
# 进程持续运行多久才认为是启动成功
startsecs=1
# 重试次数
startretries=3
# stderr 日志输出位置
stderr_logfile=/www/go/src/gin-api/runtime/stderr.log
# stdout 日志输出位置
stdout_logfile=/www/go/src/gin-api/runtime/stdout.log

命令

#查看所有服务的状态
supervisorctl status
服务名 = user-center-gift:user-center-gift_00
#启动服务
supervisorctl start 服务名
#停止服务
supervisorctl stop 服务名
#重启服务
supervisorctl restart 服务名

常见报错

端口占用

Starting supervisor: Error: Another program is already listening on a port that one of our HTTP servers is configured to use.  Shut this program down first before starting supervisord.
For help, use /usr/bin/supervisord -h

显示的是有另一个进程占用了监听端口

查出来 kill掉
ps -ef | grep supervisord

提示setuptools版本问题

/usr/local/lib/python2.7/dist-packages/pkg_resources/py2_warn.py:21: UserWarning: Setuptools will stop working on Python 2
************************************************************
You are running Setuptools on Python 2, which is no longer
supported and
>>> SETUPTOOLS WILL STOP WORKING <<<
in a subsequent release (no sooner than 2020-04-20).
Please ensure you are installing
Setuptools using pip 9.x or later or pin to `setuptools<45`
in your environment.
If you have done those things and are still encountering
this message, please follow up at
https://bit.ly/setuptools-py2-warning.
************************************************************
sys.version_info < (3,) and warnings.warn(pre + "*" * 60 + msg + "*" * 60)
supervisor>

先看下版本

root@xxxxxx:~# which python
/usr/bin/python
root@xxxxxx:~# /usr/bin/python -V
Python 2.7.12 root@xxxxxx:~# which pip
/usr/bin/pip
root@xxxxxx:~# pip -V
pip 8.1.1 from /usr/lib/python2.7/dist-packages (python 2.7)

升级

pip2 install --upgrade --user pip

#使用pip 9.x或更高版本的Setuptools或固定setuptools<45在您的环境中
pip2 install --user "setuptools<45"

supervisor 安装和基本使用的更多相关文章

  1. supervisor安装和配置

    直接命令 easy_install supervisor 如果报错先安装 yum install python-setuptools,再上面一条命令: 安装成功后显示finished,我们再次进行py ...

  2. Supervisor 安装及配置管理uwsgi进程

    Supervisor介绍 Supervisor 允许其用户在UNIX类操作系统上控制多个进程. 块如下: 方便 需要为每个进程实例编写rc.d脚本通常是不方便的. rc.d脚本是进程初始化/自动启动/ ...

  3. mac下supervisor安装及简单配置

    supervisor是一个用 Python 写的进程管理工具,可以很方便的用来启动.重启.关闭进程(守护进程).可以用他来管理自己的“服务程序”. 安装 首先安装Python,Mac系统好像自带. 执 ...

  4. supervisor安装、使用详解

    supervisor是用python写的一个进程管理工具,用来启动,重启,关闭进程. 1 supervisor的安装 pip install supervisor 2 supervisor的配置文件( ...

  5. supervisor安装部署和使用实例

    Supervisord是用Python实现的一款非常实用的进程管理工具,类似于monit,monit和supervisord的一个比较大的差异是supervisord管理的进程必须由superviso ...

  6. Supervisor安装与配置(Linux/Unix进程管理工具)

    原文链接:http://blog.csdn.net/xyang81/article/details/51555473 Supervisor(http://supervisord.org/)是用Pyth ...

  7. Linux系统下 Supervisor 安装搭建(yum安装)

    安装Supervisor # 安装supervisor yum install supervisor # 打开supervisor的配置文件 vi /etc/supervisord.conf 将sup ...

  8. Linux系统下 Supervisor 安装搭建

    在 web 应用部署到线上后,需要保证应用一直处于运行状态,在遇到程序异常.报错等情况,导致 web 应用终止时,需要保证程序可以立刻重启,继续提供服务. 所以,就需要一个工具,时刻监控 web 应用 ...

  9. supervisor安装及其配置

    一.supervisor概述 supervisor是一个c/s系统,被用来在类Unix系统中监控进程状态.supervisor使用python开发. 服务端进程为supervisord,主要负责启动自 ...

  10. Supervisor安装与配置

    Supervisor(http://supervisord.org/)是用Python开发的一个client/server服务,是Linux/Unix系统下的一个进程管理工具,不支持Windows系统 ...

随机推荐

  1. Solution - AGC060B

    Link 简要题意:在 \(n \times m\) 的方格表中填入一些不超过 \(2^k-1\) 的数.考虑所有从左上角到右下角的最短路径,要求其中满足路径上数异或和为 \(0\) 的路径只有给定的 ...

  2. vim 使用black 格式化python代码

    vim 使用black 格式化代码 github black 的github https://github.com/psf/black 安装 pip3 install black 使用 black f ...

  3. pde复习笔记 第一章 波动方程 第三节 分离变量法

    教材 谷超豪<数学物理方程>第四版,虽然我们老师用的第三版,但是除了页码对不上,习题多了一点,也似乎没有多少区别. 打算开个新栏专门总结一下pde的各种计算问题,在图书馆算的手麻了,但是习 ...

  4. 【Python自动化】定时自动采集,并发送微信告警通知,全流程案例讲解!

    目录 一.概要 二.效果演示 三.代码讲解 3.1 爬虫采集行政处罚数据 3.2 存MySQL数据库 3.3 发送告警邮件&微信通知 3.4 定时机制 四.总结 一.概要 您好!我是@马哥py ...

  5. Java工具类库大总结

    1. Java自带工具方法 1.1 List集合拼接成以逗号分隔的字符串 // 如何把list集合拼接成以逗号分隔的字符串 a,b,c List<String> list = Arrays ...

  6. C语言:生成单词列表----使用单链表实现

    解决之前用结构体数组导致内存过剩问题,使用动态分配内存优化单词列表. txt文本内容不允许出现其他字符形式,这个仅限于判断在txt网页文件已经删除了超链接等,文本里面只允许出现单词才能进行判断和进行单 ...

  7. layui 新增行

    layui表格新增行目前只在从内存加载数据的情况下可行! 在多方查找数据与实验后,我发现layui确实只能在直接赋值数据(从内存加载数据)的情况下新增行,即首次渲染表格时使用内存数据给表格的data参 ...

  8. wxPython==4.2.1 aui.AuiToolBar 如何去掉烦人的抓手?

    aui.AuiToolBar 如何去掉烦人的抓手? 最近在用wxPython做一些GUI小应用,发现工具栏总有几个点(抓手),很影响美观,如下: 目前官方没有提供隐藏抓手的功能,需要更改源码的auib ...

  9. BigDecimal类的基本使用

    概述 java在java.math包中提供的API类BigDecimal,用来对超过16位有效位的数进行精确的运算.双精度浮点型变量double可以处理16位有效数.在实际应用中,需要对更大或者更小的 ...

  10. 来自多彩世界的控制台——C#控制台输出彩色字符画

    引言 看到酷安上有这样一个活动,萌生了用 C# 生成字符画的想法,先放出原图.   酷安手绘牛啤     §1 黑白 将图像转换成字符画在 C# 中很简单,思路大致如下: 加载图像,逐像素提取明度. ...