PM2 是一个守护进程管理器,它将帮助您管理和保持您的应用程序在线。PM2的入门很简单,它是一个简单直观的CLI,可以通过NPM安装。
安装
$ npm install pm2@latest -g
运行
$ pm2 start app.js --name my-api # Name process
$ pm2 list # Display all processes status
$ pm2 jlist # Print process list in raw JSON
$ pm2 prettylist # Print process list in beautified JSON
$ pm2 reload all # Will 0s downtime reload (for NETWORKED apps)
$ pm2 stop 0 # Stop specific process id
$ pm2 restart 0 # Restart specific process id
$ pm2 delete 0 # Will remove process from pm2 list