Linux Nodejs永远,在启动时运行--观察不工作

Linux Nodejs永远,在启动时运行--观察不工作,linux,node.js,boot,watch,forever,Linux,Node.js,Boot,Watch,Forever,我是linux新手,刚刚使用Ubuntu12.04在linode上安装了一台服务器 我在/etc/init/中创建了一个myconfig.conf文件,其中包含以下内容 start on startup stop on shutdown respawn exec sudo -u myUser /usr/local/bin/forever start -w /home/myUser/myProject/server.js 当我重新启动linux服务器节点时,在某些情况下,我可以在节点服务器死亡

我是linux新手,刚刚使用Ubuntu12.04在linode上安装了一台服务器

我在/etc/init/中创建了一个myconfig.conf文件,其中包含以下内容

start on startup
stop on shutdown
respawn

exec sudo -u myUser /usr/local/bin/forever start -w /home/myUser/myProject/server.js
当我重新启动linux服务器节点时,在某些情况下,我可以在节点服务器死亡前访问它1秒。如果我在不使用watch选项-w的情况下运行它,它工作得很好。我也可以在手动运行时使用watch选项,而不会出现问题,只有在使用conf文件时才会出现这种情况。是否需要指定一些路径,以便永远知道要查看哪些文件

提前谢谢

我使用和nodemon,然后使用chkconfig实用程序在重新启动时启动它

例如:

此永久服务命令执行以下操作:每次修改applications dist/assets文件夹中的json或raml文件时,请等待10秒钟,然后重新启动node app server.js脚本:

$ forever-service install raml --script server.js -f " -c nodemon" -o " --delay 10 --watch dist/assets -e json,raml --exitcrash" -e "PATH=/usr/local/bin:$PATH"
然后,我可以将服务设置为在服务器重新启动时启动:

$ chkconfig --add raml
$ chkconfig raml on

谢谢你的回答!我发现另一种方法不能准确地回忆起我的解决方案,即服务在重新启动时启动,但我目前没有监视机制。我一定会看看你的解决方案。