supervisor python_使用supervisor运行python脚本

博主尝试使用Supervisor来确保Python守护进程的持续运行,配置文件已经设置,但Supervisor在启动进程后不断重试并最终进入FATAL状态。问题可能是由于run()方法未返回任何内容导致Supervisor认为进程失败。独立运行daemon_runnner.py脚本没有问题。
摘要由CSDN通过智能技术生成

我从here复制了以作为守护进程运行Python代码。

为了延长正常运行时间。我想最好使用supervisor来保持这个守护进程的运行。

我做到了。

python_deamon.conf[program:python_deamon]

directory=/usr/local/python_deamon/

command=/usr/local/python_venv/bin/python daemon_runnner.py start

stderr_logfile=/var/log/gunicorn.log

stdout_logfile=/var/log/gunicorn.log

autostart=true

autorestart=true

问题是,尽管supervisor成功地启动了python_守护进程,但它仍在重试。2015-09-23 16:10:45,592 CRIT Supervisor running as root (no user in config file)

2015-09-23 16:10:45,592 WARN Included extra file "/etc/supervisor/conf.d/python_daemon.conf" during parsing

2015-09-23 16:10:45,592 INFO RPC interface 'supervisor' initialized

2015-09-23 16:10:45,592 CRIT Server 'unix_http_server' running without any HTTP authentication checking

2015-09-23 16:10:45,592 INFO supervisord started with pid 13880

2015-09-23 16:10:46,595 INFO spawned: 'python_deamon' with pid 17884

2015-09-23 16:10:46,611 INFO exited: python_deamon (exit status 1; not expected)

2015-09-23 16:10:47,614 INFO spawned: 'python_deamon' with pid 17885

2015-09-23 16:10:47,630 INFO exited: python_deamon (exit status 1; not expected)

2015-09-23 16:10:49,635 INFO spawned: 'python_deamon' with pid 17888

2015-09-23 16:10:49,656 INFO exited: python_deamon (exit status 1; not expected)

2015-09-23 16:10:52,662 INFO spawned: 'python_deamon' with pid 17891

2015-09-23 16:10:52,680 INFO exited: python_deamon (exit status 1; not expected)

2015-09-23 16:10:53,681 INFO gave up: python_deamon entered FATAL state, too many start retries too quickly

为了记录重写后的run()方法,我从不返回任何内容。

有没有可能做我想做的事,或者我是在装傻?

p.S:我知道整个问题的根本原因是,由于run()从不返回任何主管一直试图启动它,因此认为进程失败,并将状态设为FATAL Exited too quickly (process log may have details)。

我真正的问题是我做得对吗?或者可以这样做?

p.p.S:独立(不带主管)daemon_runnner.py在有和没有sudo权限的情况下运行良好。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值