[英]node.js v0.11.14 as service with --harmony
I am using Amazon linux on EC2 and node.js v0.11.14. 我在EC2和node.js v0.11.14上使用Amazon linux。
I need to start node as service with parameter harmony 我需要将节点作为参数和谐的服务启动
node --harmony app.js
how to achieve this with forever or other package? 如何使用永久或其他软件包实现这一目标?
I found answers like forever start -c "node --harmony" app.js
but this is not working. 我找到了像
forever start -c "node --harmony" app.js
这样的答案,但这不起作用。
For production environment, personally, you should give a try to pm2. 对于生产环境,个人而言,应该尝试使用pm2。 PM2 is an awesome process manager for nodejs.
PM2是nodejs的出色流程管理器。 There are features like: Load balancer, running the app forever even when the server restarts and a lot more that you can read here: https://github.com/Unitech/pm2
这些功能包括:负载均衡器,即使服务器重新启动也可以永久运行该应用程序,您可以在这里阅读更多内容: https : //github.com/Unitech/pm2
To pass v8 arguments using pm2 you can use --node-args: 要使用pm2传递v8参数,可以使用--node-args:
pm2 start app.js --node-args="--harmony"
To pass arguments to the v8 engine and app.js you have to use double dashes. 要将参数传递给v8引擎和app.js,您必须使用双破折号。
pm2 start app.js --node-args="--harmony" -- arg1 arg2 arg3
Now, your node is running with --harmony
and you can access the args via process.argv
array. 现在,您的节点正在使用
--harmony
运行,您可以通过process.argv
数组访问args。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.