在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=10 loglevel = info pidfile = /tmp/supervisord.pid nodaemon = false minfds = 1024 minprocs = 200 umask = 022 identifier = 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