Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 42
  • Last Modified:

Start and keep running node.js instance

I'm trying to figure out how to keep a node.js instance running.

Right now I open up ssh and run "node server" and everything takes off and goes.  As soon as I close SSH obviously the server goes down.  I tried screen, but then my server unexpectedly quit last night, is there a better solution for starting it up and keeping it running? If crashes then restart it?
0
Nathan Riley
Asked:
Nathan Riley
  • 2
2 Solutions
 
BigRatCommented:
Try the "forever" package. There's a tutorial here http://www.slidequest.com/q/70ang
0
 
Jan SpringerCommented:
And, use forever in an init script.  If you have ubuntu, you can use upstart or systemctl if it's a later version.  With CentOS, you can easily create an init script.

This way, your job will start on boot, as well.
0
 
Nathan RileyFounder/CTOAuthor Commented:
I agree with this, worked for me.
0
 
Jan SpringerCommented:
The author was provided with the best solution.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now