python3 supervisor 接口,supervisor使用,需要注意python3 pip

在linux里用pip install supervisor,配置文件都在**/usr/local/python3/bin**里,安装时会有黄色字提醒的:

WARNING: The scripts echo_supervisord_conf, pidproxy, supervisorctl and supervisord are installed in ‘/usr/local/python3/bin‘ which is not on PATH.

Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

1

2

所以当我们在自己项目里用vim配置好自己写的supervisor.conf 时,执行

supervisord -c supervisor.conf 时,会报错:无法找到supervisord这个包。

解决办法:

cd /usr/local/python3/bin,里面有echo_supervisord_conf, pidproxy, supervisorctl and supervisord 。

我们只要

cp supervisord /usr/bin/

1

把supervisord复制到/usr/bin/目录下即可

再次执行,亲测可以成功。

/etc/supervisord.conf内容:

[supervisord]

logfile= /tmp/supervisord.log

logfile_maxbytes=50MB

logfile_backups=10loglevel=info

pidfile= /tmp/supervisord.pid

nodaemon=false

minfds= 1024minprocs= 200umask= 022identifier=supervisor

directory= /tmp

nocleanup=true

childlogdir= /tmp

strip_ansi=false

[supervisorctl]

serverurl= unix:///tmp/supervisor.sock

prompt=mysupervisor

[program:MyFlask]#启动命令入口

command=/usr/bin/uwsgi /opt/onlinewww/MyFlask/uwsgi.ini

directory=/opt/onlinewww/MyFlask#运行命令的用户名

user=root

autostart=true #跟随Supervisor一起启动

autorestart=true #挂掉之后自动重启#日志地址#stdout_logfile=/var/www/app/logs/uwsgi_supervisor.log

启动:supervisord -c /etc/supervisord.conf

原文:https://www.cnblogs.com/anthony-wang0228/p/12687815.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在 Windows 上使用 supervisor需要先安装 Python 和 supervisor。 1. 安装 Python 首先,从 Python 官网下载适用于 Windows 的 Python 安装包,并按照提示进行安装。 2. 安装 supervisor 使用 pip 工具安装 supervisor: ``` pip install supervisor ``` 3. 配置 supervisor 在 Windows 上,需要手动创建 supervisor 的配置文件。可以创建一个名为 supervisord.conf 的文件,内容如下: ``` [unix_http_server] file=/var/run/supervisor.sock ; (the path to the socket file) [supervisord] logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log) pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP) ; the below section must remain in the config file for RPC ; (supervisorctl/web interface) to work, additional interfaces may be ; added by defining them in separate rpcinterface: sections [rpcinterface:supervisor] supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface [supervisorctl] serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket [program:hello] command=python /path/to/hello.py ; the program (relative uses PATH, can take args) autostart=true ; start at supervisord start (default: true) autorestart=true ; restart on exit (default: false) stderr_logfile=/var/log/hello.err.log ; stderr log path, NONE for none; default AUTO stdout_logfile=/var/log/hello.out.log ; stdout log path, NONE for none; default AUTO ``` 其中,[program:hello] 是一个示例程序,可以根据需要修改。 4. 启动 supervisor 使用命令行窗口,进入 supervisor 的安装目录,然后执行以下命令启动 supervisor: ``` supervisord -c /path/to/supervisord.conf ``` 这里的 /path/to/supervisord.conf 是 supervisord.conf 文件的路径。 5. 使用 supervisorctl 管理程序 启动 supervisor 后,可以使用 supervisorctl 命令管理程序。例如: ``` supervisorctl start hello supervisorctl stop hello supervisorctl restart hello ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值