How to run Node.js as a background process and never die?

前端 未结 14 1107
刺人心
刺人心 2020-11-22 10:59

I connect to the linux server via putty SSH. I tried to run it as a background process like this:

$ node server.js &

However, after 2.5

14条回答
  •  滥情空心
    2020-11-22 11:32

    nohup will allow the program to continue even after the terminal dies. I have actually had situations where nohup prevents the SSH session from terminating correctly, so you should redirect input as well:

    $ nohup node server.js 

    Depending on how nohup is configured, you may also need to redirect standard output and standard error to files.

提交回复
热议问题