2

I just put my node application up on my ubuntu server. I successfully started the program using

nodejs index.js 

Now it gives me the "listening on *:3000"

The problem is that I am ssh'd into my ubuntu server, but the cursor is stuck under the "listening" line.

1) How can I close my ssh session and leave the node running? Should I have started the node with a different user?

2) Once I successfully close my ssh session and the node is still running. How can I stop node once I ssh back into the server?

3) Say I ssh into the server and start run my nodejs file, but I then want to do some other simple work for unrelated sites on the same server. Since the cursor is stuck after "listening" line, how can I go about doing anything else?

1
  • 3
    This is what you'll want to use: help.ubuntu.com/community/Screen Alternatively, you can run your command as a service. Look into UpStart. Commented Jun 10, 2015 at 20:44

1 Answer 1

1

I suggest that you use the screen program. Screen is a terminal multiplexer, which allows a user to access multiple separate terminal sessions inside a single terminal window or remote terminal session (such as when using SSH).

It can be started by typing screen on a terminal. Inside it, you can call node.js as usual. Then you press Ctrl+a and type d to detach it. To re-attach a detached session type screen -r.

More information can be found on the manual

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.