Solved

Start and keep running node.js instance

Posted on 2016-08-10
4
33 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:N R
  • 2
4 Comments
 
LVL 27

Accepted Solution

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

Assisted Solution

by:Jan Springer
Jan Springer earned 250 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 11

Author Comment

by:N R
ID: 41775043
I agree with this, worked for me.
0
 
LVL 28

Expert Comment

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

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
alert on input text 2 23
How Close unsubmited attempts 10 42
Find out all repos that a user is most active on Github 1 26
Problem evaluating javascript equality expression 8 17
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
The purpose of this article is to demonstrate how we can use conditional statements using Python.
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)
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

680 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