Supervisor安装

环境

系统:CentOS 6.6 | CentOS 7.4

准备

  • 安装pip

Supervisor安装

  • 安装

    # pip install supervisor
    
  • 配置

    # echo_supervisord_conf > /etc/supervisord.conf
    
    # vim /etc/supervisord.conf
    [unix_http_server]
    file=/var/run/supervisor.sock
    
    [supervisord]
    pidfile=/var/run/supervisor.pid
    
    [supervisorctl]
    serverurl=unix:///var/run/supervisor.sock
    
    [include]
    files=/etc/supervisor/*.ini
    
    # vim /etc/supervisor/my_app.ini
    [program:my_app]
    command=/usr/local/jdk/bin/java -jar my_app.jar
    directory=/data/app/%(program_name)s
    user=root
    redirect_stderr=true
    stdout_logfile=/data/logs/%(program_name)s.log
    stdout_logfile_maxbytes=500MB
    

Supervisor启动

CentOS 6.6

  • 添加开机启动

    # vim /etc/rc.local
    supervisord
    
  • 启动

    # supervisord
    

CentOS 7.4

  • 添加启动服务

    # vim /usr/lib/systemd/system/supervisord.service
    [Unit]
    Description=Process Monitoring and Control Daemon
    After=rc-local.service nss-user-lookup.target
    
    [Service]
    Type=forking
    ExecStart=/usr/bin/supervisord -c /etc/supervisord.conf
    
    [Install]
    WantedBy=multi-user.target
    
  • 启动

    # systemctl enable supervisord.service
    # systemctl start supervisord.service
    

你可能感兴趣的:(Supervisor安装)