最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】把项目文件移动位置后重启supervisor

Flask crifan 2418浏览 0评论

在把整个的项目文件,从:

/root/RunningFast

移动到:

/root/RunningFast/stable

之后,修改了

supervisor.conf

配置为:

[program:runningfast_stable]
directory=/root/RunningFast/stable
command=/root/Envs/RunningFast/bin/gunicorn -w 4 -b 0.0.0.0:21084 run:app &
startsecs=0
stopwaitsecs=0
autostart=false
autorestart=false
stdout_logfile_maxbytes=1MB
stderr_logfile_maxbytes=1MB
stdout_logfile=/root/RunningFast/stable/logs/gunicorn.log
stderr_logfile=/root/RunningFast/stable/logs/gunicorn.err

然后希望可以重启服务

结果失败了:

(RunningFast) ➜  stable supervisorctl -c supervisor.conf reload
Restarted supervisord
(RunningFast) ➜  stable supervisorctl -c supervisor.conf reload
error: <class ‘socket.error’>, [Errno 2] No such file or directory: file: /usr/local/lib/python2.7/socket.py line: 228
(RunningFast) ➜  stable supervisorctl -c supervisor.conf reload
error: <class ‘socket.error’>, [Errno 2] No such file or directory: file: /usr/local/lib/python2.7/socket.py line: 228
(RunningFast) ➜  stable supervisorctl -c supervisor.conf restart runningfast_stable
unix:///tmp/supervisor.sock no such file

然后再去试试,就可以了:

(RunningFast) ➜  stable supervisord -c supervisor.conf
(RunningFast) ➜  stable supervisorctl -c supervisor.conf reload
Restarted supervisord
(RunningFast) ➜  stable supervisorctl -c supervisor.conf start runningfast_stable
runningfast_stable: started
(RunningFast) ➜  stable supervisorctl -c supervisor.conf stop runningfast_stable
runningfast_stable: stopped
(RunningFast) ➜  stable supervisorctl -c supervisor.conf restart runningfast_stable
runningfast_stable: ERROR (not running)
runningfast_stable: started
(RunningFast) ➜  stable supervisorctl -c supervisor.conf restart runningfast_stable
runningfast_stable: stopped
runningfast_stable: started

【总结】

在Flask的项目文件移动位置后,记得及时更新supervisor.conf的配置,主要是里面的:

[program:runningfast_stable]
directory=/root/RunningFast/stable
stdout_logfile=/root/RunningFast/stable/logs/gunicorn.log
stderr_logfile=/root/RunningFast/stable/logs/gunicorn.err

就可以正常运行:

supervisord -c supervisor.conf
supervisorctl -c supervisor.conf reload
supervisorctl -c supervisor.conf start runningfast_stable

即可。

转载请注明:在路上 » 【已解决】把项目文件移动位置后重启supervisor

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.190 seconds, using 22.19MB memory