zoukankan      html  css  js  c++  java
  • supervisor管理python程序

    1. 下载supervisor

        0 16:47:26 root@test,172.16.1.12:~ # yum -y install supervisor
      
    2. 配置supervisor

        0 16:49:51 root@test,172.16.1.12:~ # cp /etc/supervisord.conf{,.bak}
        0 16:50:14 root@test,172.16.1.12:~ # vim /etc/supervisord.conf
      [unix_http_server]
      file=/server/data/supervisord/supervisor.sock   ; the path to the socket file
      
      [supervisord]
      logfile=/server/logs/supervisord/supervisord.log ; main log file; default $CWD/supervisord.log
      logfile_maxbytes=50MB        ; max main logfile bytes b4 rotation; default 50MB
      logfile_backups=10           ; # of main logfile backups; 0 means none, default 10
      loglevel=info                ; log level; default info; others: debug,warn,trace
      pidfile=/server/data/supervisord/supervisord.pid ; supervisord pidfile; default supervisord.pid
      nodaemon=false               ; start in foreground if true; default false
      minfds=1024                  ; min. avail startup file descriptors; default 1024
      minprocs=200                 ; min. avail process descriptors;default 200
      
      [rpcinterface:supervisor]
      supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
      
      [supervisorctl]
      serverurl=unix:///server/data/supervisord/supervisor.sock ; use a unix:// URL  for a unix socket
      
      [include]
      files = /etc/supervisord.d/*.conf
      
    3. 启动supervisor

        0 16:52:09 root@test,172.16.1.12:~ # mkdir -p /server/data/supervisord /server/logs/supervisord
        0 16:53:04 root@test,172.16.1.12:~ # systemctl start supervisord.service 
        0 16:55:00 root@test,172.16.1.12:~ # systemctl enable supervisord.service
      
    4. 管理一个python程序。

        0 16:55:33 root@test,172.16.1.12:~ # vim /etc/supervisord.d/backend.conf
      [program:backend]
      
      directory=/datas/app/platform/backend
      command=/datas/app/platform/backend/venv/bin/python manage.py runserver 0.0.0.0:8000
      autorestart=true
      
    5. 加载配置自动启动。

        0 17:03:01 root@test,172.16.1.12:/etc/supervisord.d # supervisorctl reload
      Restarted supervisord
        0 17:03:06 root@test,172.16.1.12:/etc/supervisord.d # supervisorctl status
      backend                          RUNNING   pid 256117, uptime 0:00:02
      


    写作不易,转载请注明出处,谢谢~~

  • 相关阅读:
    P2523 [HAOI2011]Problem c
    P2518 [HAOI2010]计数
    P2513 [HAOI2009]逆序对数列
    P2519 [HAOI2011]problem a
    P5020 货币系统
    P2580 于是他错误的点名开始了(Trie)
    P3805 【模板】manacher算法
    基础
    白兔的字符串(hash入门)
    ACM的分类训练题集(转载)
  • 原文地址:https://www.cnblogs.com/ccbloom/p/15119664.html
Copyright © 2011-2022 走看看