主管退出ENOENT

时间:2018-02-25 22:59:37

标签: django gunicorn supervisor

我试图在Digital Ocean Ubuntu 16.04服务器上使用NGINIX,Gunicorn和Supervisor首次部署Django Web应用程序。我正在关注this linked tutorial

我在配置Supervisor时遇到问题。运行此命令时......

sudo supervisorctl status automatedre

我收到此错误...

automatedre               FATAL     Exited too quickly (process log may have details)

日志文件显示了这个......

supervisor: couldn't exec /home/automatedre/gunicorn_start: ENOENT
supervisor: child process was not spawned
supervisor: couldn't exec /home/automatedre/gunicorn_start: ENOENT
supervisor: child process was not spawned

/家庭/ automatedre / gunicorn_start

#!/bin/bash

NAME="django_automatedre"
DIR=/home/automatedre/automatedre
USER=automatedre
GROUP=automatedre
WORKERS=3
BIND=unix:/home/automatedre/run/gunicorn.sock
DJANGO_SETTINGS_MODULE=automatedre.settings
DJANGO_WSGI_MODULE=automatedre.wsgi
LOG_LEVEL=error

cd $DIR
source ../venv/bin/activate

export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
export PYTHONPATH=$DIR:$PYTHONPATH

exec ../venv/bin/gunicorn ${DJANGO_WSGI_MODULE}:application \
  --name $NAME \
  --workers $WORKERS \
  --user=$USER \
  --group=$GROUP \
  --bind=$BIND \
  --log-level=$LOG_LEVEL \
  --log-file=-

/etc/supervisor/conf.d/automatedre.conf

[program:automatedre]
command=/home/automatedre/gunicorn_start
user=automatedre
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/home/automatedre/logs/gunicorn.log

我不知道从哪里开始。我不相信这是文件权限问题,因为我以前用 gunicorn_start 更改了权限...

chmod u+x gunicorn_start

关于我哪里出错的任何想法?

2 个答案:

答案 0 :(得分:1)

我之前从日志文件中遗漏了下面的文字,因为我认为它不相关......错误。

/home/automatedre/gunicorn_start: 2: /home/automatedre/gunicorn_start: ^M: not found
/home/automatedre/gunicorn_start: 12: /home/automatedre/gunicorn_start: ^M: not found
/home/automatedre/gunicorn_start: 13: cd: can't cd to /home/automatedre/automatedre^M
/home/automatedre/gunicorn_start: 14: /home/automatedre/gunicorn_start: source: not found
/home/automatedre/gunicorn_start: 15: /home/automatedre/gunicorn_start: ^M: not found
/home/automatedre/gunicorn_start: 18: /home/automatedre/gunicorn_start: ^M: not found
/home/automatedre/gunicorn_start: 19: exec: ../venv/bin/gunicorn: not found

我最初在我的Windows机器上的Brackets文本编辑器中创建了 / home / automatedre / gunicorn_start /etc/supervisor/conf.d/automatedre.conf 。创造了这个问题。

在做了一些挖掘之后,我学会了Windows/MS-DOS uses CR+LF to indicate end-of-lines and UNIX uses LF character to indicate line termination (EOL character)

这种差异导致每行末尾的^ M导致文件路径未找到错误。

使用nano从终端重新创建每个文件解决了这个问题。

答案 1 :(得分:0)

要获取更多信息,您可以将LOG_LEVEL=error更改为LOG_LEVEL=debug

相关问题