0

I currently connected to a ubuntu server by ssh.I wrote an activated a nodejs server and currently running on shell and can be reached by internet. My question If I close my ssh window will this process be terminated on server . if not next time when i connect to the server how i can reach this working terminal again .

nikoss
  • 3,254
  • 2
  • 26
  • 40

1 Answers1

1

From the description on its website, there is no mention of the server detaching from the controlling terminal or suppressing SIGHUP. So yes - you will probably terminate your server.

This has been discussed before, in Node.js as a background service, which suggests the usual solutions:

  • use nohup (and then you lose direct control over the server if you log out)
  • run the server within screen(1), which allows you to attach to that screen session when you log in again.

If your remote host does not have screen, of course that limits your options. However, if you have full control over the server, you should be able to install screen as follows

sudo apt-get install screen

screen is simple enough to use (but there is much documentation). For the use which you would make, you would do

screen

to run a session, and in the resulting shell session, run your server. To detach, type control A. To reattach, I would use

screen -x
Community
  • 1
  • 1
Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105