how to automatically restart a node server?

transient_loop picture transient_loop · May 14, 2013 · Viewed 67.1k times · Source

We are finishing development of a project, the client is already using it but occasionally some errors occur - crashing the server.

I know I could register a service as 'upstart' script on linux, in order to have my node service restart when it crashes.

But our server is running other stuff, so we can't restart it. Well, actually, while writing, I realize I have two questions then:

  • Will 'upstart' work without having to reboot? Something is just whispering yes to me :)
  • If not, what other option would I have to 'respawn' my node server when it crashes?

Answer

Daniel picture Daniel · May 14, 2013

Yes, upstart will restart your process without a reboot.

Also, you should look into forever.