?
Solved

Start and keep running node.js instance

Posted on 2016-08-10
4
Medium Priority
?
40 Views
Last Modified: 2016-08-30
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
Comment
Question by:Nathan Riley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 27

Accepted Solution

by:
BigRat earned 1000 total points (awarded by participants)
ID: 41751842
Try the "forever" package. There's a tutorial here http://www.slidequest.com/q/70ang
0
 
LVL 29

Assisted Solution

by:Jan Springer
Jan Springer earned 1000 total points (awarded by participants)
ID: 41752044
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
 
LVL 12

Author Comment

by:Nathan Riley
ID: 41775043
I agree with this, worked for me.
0
 
LVL 29

Expert Comment

by:Jan Springer
ID: 41776021
The author was provided with the best solution.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question