新贵挂在停止

时间:2013-01-30 22:11:19

标签: django linux gunicorn upstart

在upstart遇到问题我可以启动但是当我运行时

sudo stop up

它挂起

这是.conf文件

# my upstart django script
# this script will start/stop my django development server
# optional stuff
description "start and stop the django development server"
version "1.0"
author "Calum"

console log

# configuration variables.
# You'll want to change thse as needed
env DJANGO_HOME=/home/calum/django/django-nexus7/nexus7
env DJANGO_PORT=8000
env DJANGO_HOST=0.0.0.0 # bind to all interfaces

# tell upstart we're creating a daemon
# upstart manages PID creation for you.
expect fork

script
# My startup script, plain old shell scripting here.
chdir $DJANGO_HOME
pwd
exec /usr/bin/python manage.py run_gunicorn -c config/gunicorn
#exec /usr/bin/python manage.py runserver $DJANGO_HOST:$DJANGO_PORT &
# create a custom event in case we want to chain later
emit django_running
end script
如果有人能让我知道它为什么会挂起来,我会非常感激吗?

1 个答案:

答案 0 :(得分:4)

我想我已经弄明白了,或者至少得到了一些有用的东西。

# my upstart django script
# this script will start/stop my django development server
# optional stuff
description "start and stop the django development server"
version "1.0"
author "Calum"

console log

# configuration variables.
# You'll want to change thse as needed
env DJANGO_HOME=/home/calum/django/django-nexus7/nexus7
env DJANGO_PORT=8000
env DJANGO_HOST=0.0.0.0 # bind to all interfaces

# tell upstart we're creating a daemon
# upstart manages PID creation for you.
#expect fork

script
# My startup script, plain old shell scripting here.
chdir $DJANGO_HOME
/usr/bin/python manage.py run_gunicorn -c config/gunicorn
end script

我学到的东西可以帮助别人:

  • 不要在脚本标签中使用exec,只需将其编码为就像在shell中一样
  • 如果你分叉一次,请使用expect fork
  • 如果你分叉两次,请使用expect守护进程