如何将 Node.js 作为后台进程运行并且永不消亡? - How to run Node.js as a background process and never die?

问题:

I connect to the linux server via putty SSH.我通过 putty SSH 连接到 linux 服务器。 I tried to run it as a background process like this:我试图将它作为这样的后台进程运行:

$ node server.js &

However, after 2.5 hrs the terminal becomes inactive and the process dies.但是,2.5 小时后终端变为非活动状态并且进程终止。 Is there anyway I can keep the process alive even with the terminal disconnected?无论如何,即使终端断开连接,我也可以保持进程活跃吗?


Edit 1编辑 1

Actually, I tried nohup , but as soon as I close the Putty SSH terminal or unplug my internet, the server process stops right away.实际上,我尝试过nohup ,但是只要我关闭 Putty SSH 终端或拔下互联网,服务器进程就会立即停止。

Is there anything I have to do in Putty?我需要在 Putty 中做些什么吗?


Edit 2 (on Feb, 2012)编辑 2(2012 年 2 月)

There is a node.js module, forever .有一个node.js模块,永远 It will run node.js server as daemon service.它将作为守护程序服务运行 node.js 服务器。


解决方案:

参考一: https://en.stackoom.com/question/K7vm
参考二: https://stackoom.com/question/K7vm
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章