Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to start a process that won't end when my ssh session ends?

Somehow this isn't yielded by a google search.

I'm scripting a server in node.js. I start the server by executing its script with the node program:

node myserver.js

But the server staying up is dependent on my ssh session. How can I make this (and all such processes) persistent? Init.d?

like image 325
mkrecny Avatar asked Dec 10 '22 13:12

mkrecny


1 Answers

Use the nohup command:

From http://en.wikipedia.org/wiki/Nohup

nohup is a POSIX command to ignore the HUP (hangup) signal, enabling the command to keep running after the user who issues the command has logged out. The HUP (hangup) signal is by convention the way a terminal warns depending processes of logout.

Try this:

nohup node myserver.js &
like image 200
B Johnson Avatar answered Mar 15 '23 17:03

B Johnson