┌─────────────────────┬────┬──────┬────────┬───┬──────┬───────────┐ │ Name │ id │ mode │ status │ ↺ │ cpu │ memory │ ├─────────────────────┼────┼──────┼────────┼───┼──────┼───────────┤ │ AppName │ 0 │ fork │ online │ 0 │ 0.2% │ 31.3 MB │ └─────────────────────┴────┴──────┴────────┴───┴──────┴───────────┘ Use `pm2 show <id|name>` to get more details about an app
运行应用
1 2 3 4 5 6 7
pm2 start app.js ┌─────────────────────┬────┬──────┬────────┬───┬─────┬───────────┐ │ Name │ id │ mode │ status │ ↺ │ cpu │ memory │ ├─────────────────────┼────┼──────┼────────┼───┼─────┼───────────┤ │ index │ 0 │ fork │ online │ 0 │ 0% │ 6.8 MB │ └─────────────────────┴────┴──────┴────────┴───┴─────┴───────────┘ Use `pm2 show <id|name>` to get more details about an app
停止应用(通过应用名称)
1 2 3 4 5 6 7 8 9
pm2 stop app_name [PM2] Applying action stopProcessId on app [index](ids: 1) [PM2] [index](1) ✓ ┌─────────────────────┬────┬─────────┬──────┬───────┬─────────┬─────────┬────────┬─────┬───────────┬───────┬──────────┐ │ App name │ id │ version │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │ ├─────────────────────┼────┼─────────┼──────┼───────┼─────────┼─────────┼────────┼─────┼───────────┼───────┼──────────┤ │ index │ 0 │ N/A │ fork │ 0 │ stopped │ 9 │ 0 │ 0% │ 0 B │ xxxx │ disabled │ └─────────────────────┴────┴─────────┴──────┴───────┴─────────┴─────────┴────────┴─────┴───────────┴───────┴──────────┘ Use `pm2 show <id|name>` to get more details about an app
停止应用(通过应用 id)
1 2 3 4 5 6 7 8
pm2 stop id
[PM2] Applying action deleteProcessId on app [index](ids: 1) [PM2] [index](1) ✓ ┌─────────────────────┬────┬─────────┬──────┬───────┬────────┬─────────┬────────┬─────┬───────────┬───────┬──────────┐ │ App name │ id │ version │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │ ├─────────────────────┼────┼─────────┼──────┼───────┼────────┼─────────┼────────┼─────┼─────────┴─────────┴──────┴───────┴────────┴─────────┴────────┴─────┴───────────┴───────┴──────────┘ Use `pm2 show <id|name>` to get more details about an app
Add your own code metrics: http://bit.ly/code-metrics Use `pm2 logs AppName [--lines 1000]` to display logs Use `pm2 env 0` to display environement variables Use `pm2 monit` to monitor CPU and Memory usage AppName