0

when am trying forever server.js its showing warning messages as warn: --minUptime not set. Defaulting to: 1000ms warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms

how to overcome this and keep my server on forever?

Raghu
  • 1
  • 1
  • 3
  • Possible duplicate of [Node.js as a background service](http://stackoverflow.com/questions/4018154/node-js-as-a-background-service) – winseybash Feb 17 '17 at 13:39

2 Answers2

4

There are multiple options to 'daemonise' a Node.js server, you could use screen or tmux to run the shell in the background - tmux being the my recommended choice in that situation.

If you want to stick to a node.js toolset, the lightest weight option would be forever, however if you're looking for a more advanced solution you should check out pm2.

I used to run processes with a tmux session, I then moved to forever, but found it a chore to use in a multi-user environment, I've been using PM2 for some time now with no issues.

If you're on linux this solution from another StackOverflow user may be worth considering - actually it's probably the best solution of all.

Community
  • 1
  • 1
Peter Reid
  • 5,139
  • 2
  • 37
  • 33
1

forever start -l forever.log -o out.log -e err.log server.js https://github.com/foreverjs/forever#usage

ponury-kostek
  • 7,824
  • 4
  • 23
  • 31