前端analysis | 3w & 1h

《Node》-PM2-操作命令整理

2020-03-04

pm2 介绍

用于进程守护,自动拉起进程。这里介绍都是nodejs进程管理。当然不限定与node。sh,py等都可以管理。node安装请移步

1
2
3
$ pm2 start bashscript.sh
$ pm2 start python-app.py --watch
$ pm2 start binary-file -- --port 1520

安装

1
2
3
$ npm install pm2@latest -g
# or
$ yarn global add pm2

pm2 验证

1
$ pm2

启动nodejs应用

1
2
# 应用启动端口定义所在文件
pm2 start app.js

常用命令

1
2
3
4
5
6
$ pm2 restart app_name
$ pm2 reload app_name
$ pm2 stop app_name
$ pm2 delete app_name
$ pm2 monit
$ pm2 list

查看已启动的应用

参考

pm2

使用支付宝打赏
使用微信打赏

若你觉得我的文章对你有帮助,欢迎点击上方按钮对我打赏