2015-10-16 207 views
0

我想为我的烧瓶应用程序创建一个新贵的脚本。我正在使用uWSGI来运行它。 我的应用程序驻留在/ home/user/apps/myapp中。它包含venv中的虚拟环境。 我的目标是当我运行在/ etc /初始化/命令sudo开始MYAPP激活虚拟环境和exect有为烧瓶创建新的脚本6对于烧瓶

#description "Starts my app" 
#author "Me <[email protected]>" 

start on runlevel [2345] 
stop on runlevel [!2345] 



script 
     cd /home/user/apps/myapp 
     source venv/bin/activate 
     exec uwsgi --ini myapp.ini 
end script 

INI脚本。我得到的错误是进程以127状态终止。这意味着我的命令是unkownn。我是新贵的新贵脚本。我做错了什么,这些脚本在shell中工作正常。

回答

0

source命令不是标准的shell命令。 Whatever Upstart is using internally doesn't use it.改为使用点运算符:. file

但是,您不需要uwsgi之前的任何一个命令,工作目录和virtualenv都可以在uWSGI中配置。最好让uWSGI处理虚拟环境,source activate只是在开发过程中的一种方便。

myapp.ini

[uwsgi] 
virtualenv = /path/to/env 
chdir = /path/to/project 
# other config here