Raghu
Raghu

Reputation: 1

How to set a node server to run even after closing putty?

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?

Upvotes: 0

Views: 1988

Answers (2)

Peter Reid
Peter Reid

Reputation: 5407

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.

Upvotes: 4

ponury-kostek
ponury-kostek

Reputation: 8060

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

Upvotes: 1

Related Questions