gpt4 book ai didi

django - Upstart 卡在停止

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:40:00 25 4
gpt4 key购买 nike

遇到 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

如果有人能告诉我它挂起的原因,我将不胜感激?

最佳答案

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

# 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 中一样编写代码
  • 如果 fork 一次就使用 expect fork
  • 如果你 fork 两次就使用 expect daemon

关于django - Upstart 卡在停止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14614804/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com