Supervisord python script: exit status 1; not expected cycle

I try to run the following python code with supervisord, but it starts restarting the second, I run supervisord -c / etc / supervisord.conf
Please advise?

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()

here is the logout of 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

from supervisord.conf file

[program:front]
command=python /root/python/front.py
process_name = front
autostart = true
autorestart = true
startsecs = 10
stopwaitsecs = 30
+4
source share
1 answer

Like eggonlegs, mentioned in the commentary, you can examine further magazines by checking your directory /var/log/supervisor/. I had the same problem and found that the following file was created:

celery_worker-stderr---supervisor-DEjyLf.log

(Being the name of my program [program:front]).

Having studied it, I learned that:

  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'

, , directory celery_worker.conf . :

directory = /path/to/logs/

.

, , stderr stdout

+1

Source: https://habr.com/ru/post/1527828/


All Articles