22663 次
4 に答える
2
This is what I normally do:
- Create a
service.conf
file which describes the new Python script. This script references the shell script which is the one in reality launching the Python script. This.conf
file lives inside/etc/supervisor/conf.d/
- Create a shell script which launches the Python script. Change permissions to executable.
chmod 755 service.sh
. In this script we actually launch the Python script. - Configure log_stderr and stderr_logfile to verify issue.
- Update supervisor using reload and then check status:
supervisor> status
alexad RUNNING pid 32657, uptime 0:21:05
service.conf
[program:alexad]
; Set full path to celery program if using virtualenv
command=sh /usr/local/src/gonzo/supervisorctl/alexad.sh
directory=/usr/local/src/gonzo/services/alexa
log_stdout=true ; if true, log program stdout (default true)
log_stderr=true ; if true, log program stderr (default false)
stderr_logfile=/usr/local/src/gonzo/log/alexad.err
logfile=/usr/local/src/gonzo/log/alexad.log
autostart=true
autorestart=true
startsecs=10
; Need to wait for currently executing tasks to finish at shutdown.
; Increase this if you have very long running tasks.
stopwaitsecs = 600
; When resorting to send SIGKILL to the program to terminate it
; send SIGKILL to its whole process group instead,
; taking care of its children as well.
killasgroup=true
; Set Celery priority higher than default (999)
priority=500
service.sh
#!/bin/bash
cd /usr/local/src/gonzo/services/alexa
exec python reader.py
于 2017-08-28T04:08:17.957 に答える
-1
問題がデーモン ランナーと同じかどうかはわかりませんが、デーモン コンテキストを直接使用し、supervisord を使用する場合は、context.detach_process を False に設定する必要があります。
于 2016-03-14T02:42:48.860 に答える