流浪者提供,不能开始咕噜 [英] Vagrant provision, not able to start grunt
问题描述
我试图让vagrant安装nodejs正常运行所需的所有东西。然后,在节点项目的根文件夹上执行'nohup grunt server&'后,我期待服务器在端口3030上监听,但它不是。
如果在配置完成后,我做了
vagrant ssh
grunt server&
所有工作都应该如此。只有当配置器运行它时它才起作用。
这是我的Vagrantfile的一部分:
git clone https://github.com/airbnb/rendr.git
cd / home / temp / rendr / examples / 00_simple /
npm install
cp -rf / home / temp / rendr / examples / 00_simple // home / website / nodejs / rendr-try1
cd / home / website / nodejs / rendr-try1 / 00_simple
nohup grunt server&
所以它看起来与配置器没有在终端中运行有关,但有没有简单的方法方式得到这个运行,而不使用像新贵一样的东西?
好的发现了这一点。 b $ b
事实证明,任何想要保持运行的进程都必须被正确地守护进程。为了做到这一点,必须分离stdin,stdout和stderr。
我在做
nohup grunt server&
通过grunt
启动node.js。使用替换它:
nohup grunt server 0<&> / dev / null&
非常完美
I am trying to have vagrant install all that is needed for nodejs to run properly. Then after doing a 'nohup grunt server &' on the root folder of the node project I was expecting for the server to be up listening at port 3030 but it's not.
If right after provisioning I do vagrant ssh grunt server &
all works as it should. It's only when the provisioner runs it that it doesn't work.
Here's part of my Vagrantfile:
git clone https://github.com/airbnb/rendr.git
cd /home/temp/rendr/examples/00_simple/
npm install
cp -rf /home/temp/rendr/examples/00_simple/ /home/website/nodejs/rendr-try1
cd /home/website/nodejs/rendr-try1/00_simple
nohup grunt server &
So it definitely seems to be related to the provisioner not running in a terminal, but is there any easy way to get this running without using something like upstart ?
Ok found this out.
It turns out whatever process that wants to stay running has to be properly daemonized. In order to do this one must detach stdin, stdout and stderr.
I was doing
"nohup grunt server &"
to start node.js through grunt Replacing it with:
"nohup grunt server 0<&- &>/dev/null &"
works perfectly
这篇关于流浪者提供,不能开始咕噜的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!