Search code examples
node.jsupstartforevernohupmonit

A better way to make a Node app run forever on a Linux server?


currently I use nohup and forever.js to run my app on the server (Linux) without interruption:

nohup forever app.js > logs &

plus I have a cron script that checks if my neo4j database is online and relaunches it if necessary.

However, sometimes my app quits anyway and doesn't get relaunched.

I read here that a better way of keeping a node.js running upstart and monit.

Does anyone have experience doing that and is it really functioning better?

What would be the commands to use to do that?

Thank you!


Solution

  • I have used PM2 with Keymetrics in production env which is quite reliable and lean

    http://pm2.keymetrics.io/docs/usage/monitoring/

    https://github.com/Unitech/pm2