1

新贵有问题,我可以在哪里启动它,但是当我运行时

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

如果有人能给我一个关于它为什么挂起的想法,我会非常感激?

4

1 回答 1

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 中一样对其进行编码
  • 如果你分叉一次,请使用期望叉子
  • 如果您分叉两次,请使用期望守护程序
于 2013-01-31T01:02:20.127 回答