supervisord python脚本:退出状态1;不期望循环

supervisord python脚本:退出状态1;不期望循环,第1张

概述我正在尝试使用supervisord运行以下 python代码,但它开始重新启动第二个我执行supervisord -c /etc/supervisord.conf 请指教? import urllib2import timedef goget(): url = "http://hitch.tv/grabs.php" data = urllib2.urlopen(url) 我正在尝试使用supervisord运行以下 python代码,但它开始重新启动第二个我执行supervisord -c /etc/supervisord.conf
请指教?

import urllib2import timedef goget():    url = "http://hitch.tv/grabs.PHP"    data = urllib2.urlopen(url)    grabbedpic = data.read()    with open('/root/python/tmp.txt','r') as tmpfile:        last=tmpfile.read().replace('\n','')    msgstr = []    u = 'http://hitch.tv/'    print last    if grabbedpic == last:        print "same pic"    else:        msgstr = u + grabbedpic        //send email with msgstr here         with open('tmp.txt','w') as tmpfile:            tmpfile.write(grabbedpic)    time.sleep(15)while True:    goget()

这是supervisord.log的日志输出

> 2014-02-19 22:44:17,993 INFO spawned: 'front' with pID 19859> 2014-02-19 22:44:19,278 INFO exited: front (exit status 1; not> expected) 2014-02-19 22:44:20,284 INFO spawned: 'front' with pID 19860> 2014-02-19 22:44:21,516 INFO exited: front (exit status 1; not> expected) 2014-02-19 22:44:23,523 INFO spawned: 'front' with pID 19862> 2014-02-19 22:44:24,805 INFO exited: front (exit status 1; not> expected) 2014-02-19 22:44:27,814 INFO spawned: 'front' with pID 19863> 2014-02-19 22:44:29,004 INFO exited: front (exit status 1; not> expected) 2014-02-19 22:44:30,006 INFO gave up: front entered FATAL> state,too many start retrIEs too quickly

来自supervisord.conf

[program:front]command=python /root/python/front.pyprocess_name = frontautostart = trueautorestart = truestartsecs = 10stopwaitsecs = 30
解决方法 作为评论中提到的eggonlegs,您可以通过检查/ var / log / supervisor /目录来探索更多日志.我有同样的问题,我发现创建了以下文件:

celery_worker-stderr---supervisor-DEjyLf.log

(作为我的程序的名称[程序:前面]).

通过检查,我发现:

file "/usr/lib/python3.4/logging/__init__.py",line 1006,in __init__    StreamHandler.__init__(self,self._open())  file "/usr/lib/python3.4/logging/__init__.py",line 1030,in _open    return open(self.basefilename,self.mode,enCoding=self.enCoding)PermissionError: [Errno 13] Permission denIEd: '/devel.log'

所以我的问题是由于权限,因为我没有在celery_worker.conf文件中指定目录.一旦指定:

directory = /path/to/logs/

一切都很完美.

它可能不是同一个错误,但绝对检查这些stderr或stdout日志将有所帮助

总结

以上是内存溢出为你收集整理的supervisord python脚本退出状态1;不期望循环全部内容,希望文章能够帮你解决supervisord python脚本:退出状态1;不期望循环所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/1019689.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存