How do I run a node.js app as a background service?

前端 未结 26 974
隐瞒了意图╮
隐瞒了意图╮ 2020-11-22 05:28

Since this post has gotten a lot of attention over the years, I\'ve listed the top solutions per platform at the bottom of this post.


Original post

26条回答
  •  南笙
    南笙 (楼主)
    2020-11-22 06:14

    UPDATE: i updated to include the latest from pm2:

    for many use cases, using a systemd service is the simplest and most appropriate way to manage a node process. for those that are running numerous node processes or independently-running node microservices in a single environment, pm2 is a more full featured tool.

    https://github.com/unitech/pm2

    http://pm2.io

    • it has a really useful monitoring feature -> pretty 'gui' for command line monitoring of multiple processes with pm2 monit or process list with pm2 list
    • organized Log management -> pm2 logs
    • other stuff:
      • Behavior configuration
      • Source map support
      • PaaS Compatible
      • Watch & Reload
      • Module System
      • Max memory reload
      • Cluster Mode
      • Hot reload
      • Development workflow
      • Startup Scripts
      • Auto completion
      • Deployment workflow
      • Keymetrics monitoring
      • API

提交回复
热议问题