如何將 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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章