zoukankan      html  css  js  c++  java
  • Linux supervisord配置使用 ubuntu

    supervisor官方网站 http://supervisord.org

    1、安装supervisord

    Ubuntu:

    $sudo apt-get install python-setuptools
    $sudo apt-get install  supervisor
     
    CenOS:
    sudo yum install python-setuptools-devel
    easy_install supervisor 
     
    2、配置文件的设置
    我的是Ubuntu的,配置文件/etc/supervisor/supervisord.conf
     vi supervisord.conf,文件后面添加:
    [program:test]                    ;名称
    command=XXXXX                     ;执行的命令      
    process_name=%(program_name)s  
    autostart=true                    ; 程序是否随supervisor启动而启动                
    autorestart=true                  ;程序停止时,是否自动重启                   
    startsecs=10  
    stdout_logfile=XXXX               ;日志文件的输入

    之前遇到过supervisor不产生日志的现象,缓冲区的问题,修改 command=python -u xx.py。

    3、启动supervisord

    supervisord -c supervisord.conf

    常用命令:

    启动supervisord管理的所有进程

    supervisorctl start all

     停止supervisord管理的所有进程

    supervisorctl stop all

    启动supervisord管理的某一个特定进程

    supervisorctl start program-name // program-name为[program:xx]中的xx

    停止supervisord管理的某一个特定进程 

    supervisorctl stop program-name  // program-name为[program:xx]中的xx

     重启所有进程或所有进程

    supervisorctl restart all  // 重启所有
    supervisorctl reatart program-name // 重启某一进程,program-name为[program:xx]中的xx

     查看supervisord当前管理的所有进程的状态

    supervisorctl status

    停止supervisord

    supervisorctl shutdown
    ubuntu下supervisord会随系统自启动 
     
    4、常见问题

    1)在使用命令supervisorctl start all启动控制进程时,遇到如下错误

    unix:///tmp/supervisor.sock no such file

    出现上述错误的原因是supervisord并未启动,只启动supervisord即可。

    2)提示:unix:///var/run/supervisor.sock no such file 错误

    执行以下命令:

    sudo touch /var/run/supervisor.sock
    sudo chmod 777 /var/run/supervisor.sock
    sudo service supervisor restart

     参考资料:

    http://blog.csdn.net/heyjackie/article/details/12995187

    http://www.cnblogs.com/jasonkoo/articles/3750638.html

    http://blog.csdn.net/tianjiewang/article/details/49481869

    http://www.cnblogs.com/yjf512/archive/2012/03/05/2380496.html

  • 相关阅读:
    mysql字符集设置
    mysql解压版服务启动方式
    html的表格边框为什么会这么粗?
    通过js获取tinymce4.x的值
    bzoj 3083 树链剖分
    bzoj 1143 二分图最大独立集
    bzoj 2303 并查集
    可持久化数据结构讲解
    bzoj 1072 状压DP
    bzoj 2741 可持久化trie
  • 原文地址:https://www.cnblogs.com/makeup/p/5525919.html
Copyright © 2011-2022 走看看