常用命令

装置pm2$ npm install -g pm2 命令行全局装置pm2$ pm2 logs 显示所有过程日志$ pm2 stop all 进行所有过程$ pm2 restart all 重启所有过程$ pm2 reload all 0秒停机重载过程 (用于 NETWORKED 过程)$ pm2 stop 0 进行指定的过程$ pm2 restart 0 重启指定的过程$ pm2 startup 产生 init 脚本 放弃过程活着$ pm2 web 运行强壮的 computer API endpoint$ pm2 delete 0 杀死指定的过程$ pm2 delete all 杀死全副过程 用法$ npm install pm2 -g     # 命令行装置 pm2 $ pm2 start app.js -i 4 #后盾运行pm2,启动4个app.js                                 # 也能够把'max' 参数传递给 start                                # 正确的过程数目依赖于Cpu的外围数目$ pm2 start app.js --name my-api # 命名过程$ pm2 list               # 显示所有过程状态$ pm2 monit              # 监督所有过程$ pm2 logs               #  显示所有过程日志$ pm2 stop all           # 进行所有过程$ pm2 restart all        # 重启所有过程$ pm2 reload all         # 0秒停机重载过程 (用于 NETWORKED 过程)$ pm2 stop 0             # 进行指定的过程$ pm2 restart 0          # 重启指定的过程$ pm2 startup            # 产生 init 脚本 放弃过程活着$ pm2 web                # 运行强壮的 computer API endpoint (http://localhost:9615)$ pm2 delete 0           # 杀死指定的过程$ pm2 delete all         # 杀死全副过程运行过程的不同形式:$ pm2 start app.js -i max  # 依据无效CPU数目启动最大过程数目$ pm2 start app.js -i 3      # 启动3个过程$ pm2 start app.js -x        #用fork模式启动 app.js 而不是应用 cluster$ pm2 start app.js -x -- -a 23   # 用fork模式启动 app.js 并且传递参数 (-a 23)$ pm2 start app.js --name serverone  # 启动一个过程并把它命名为 serverone$ pm2 stop serverone       # 进行 serverone 过程$ pm2 start app.json        # 启动过程, 在 app.json里设置选项$ pm2 start app.js -i max -- -a 23                   #在--之后给 app.js 传递参数$ pm2 start app.js -i max -e err.log -o out.log  # 启动 并 生成一个配置文件你也能够执行用其余语言编写的app  ( fork 模式):$ pm2 start my-bash-script.sh    -x --interpreter bash$ pm2 start my-python-script.py -x --interpreter python0秒停机重载:这项性能容许你从新载入代码而不必失去申请连贯。留神:仅能用于web利用运行于Node 0.11.x版本运行于 cluster 模式(默认模式)$ pm2 reload allCoffeeScript:$ pm2 start my_app.coffee  #这就是全副PM2筹备好为产品级服务了吗?只需在你的服务器上测试$ git clone https://github.com/Unitech/pm2.git$ cd pm2$ npm install  # 或者 npm install --dev ,如果devDependencies 没有装置$ npm testpm2 list列出由pm2治理的所有过程信息,还会显示一个过程会被启动多少次,因为没解决的异样。pm2 monit监督每个node过程的CPU和内存的应用状况。

pm2 将 vue后盾运行我的项目

pm2 start npm -- run serve

pm2 后盾运行node我的项目

1, pm2 start -i 4 npm --name butterfly-server -- run dev 2、开机启动pm2 save # 保留服务pm2 startup # 把已启动服务加到systemd中pm2 unstartup systemd # 删除主动启动服务
欢送点赞评论加转发,本文由蜗牛老湿开发一键公布平台butterfly公布