我正试图使用supervisord运行下面的python代码,但它在我执行supervisord-c/etc/supervisord.conf之后就开始重新启动 请告知?
import urllib2
import time
def 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.py
process_name = front
autostart = true
autorestart = true
startsecs = 10
stopwaitsecs = 30
正如注释中提到的
eggonlegs
,您可以通过检查/var/log/supervisor/
目录来进一步查看日志。我也有同样的问题,我发现创建了以下文件:(作为我的程序名
[program:front]
)。通过检查,我发现:
所以我的问题是由于权限,因为我没有在我的
celery_worker.conf
文件中指定directory
。一旦指定:一切正常。
这可能不是同一个错误,但检查这些
stderr
或stdout
日志肯定会有帮助相关问题 更多 >
编程相关推荐