Report this

What is the reason for this report?

regarding running terminal commands on vps

Posted on January 31, 2015

regarding running terminal commands on vps (for e.g. “node server.js”) I can run those commands using putty via my pc, but when I close putty, the node closes too. Can it be that I close my putty and the node still continues to run?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

You can do

screen -S node

and then execute your command.

Then, press control-d

After that, you can close putty.

If you want to go back to your screen session, do screen -r node

You can then do control-c to stop it, etc.

It depends on the kind of code you run. Some applications run inside your session, so when you disconnect, they stop. Others run on the background, and continue to do so if you disconnect.

Running “node server.js” is a command connected to your session, and it will stop once you disconnect. If that’s not what you want, you need to set up some kind of service or daemon that will run your for you after you disconnect.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.