Centos 安装pm2

1、执行命令

# npm install -g pm2

2、验证是否安装成功,执行命令

# pm2 -v

3、pm2使用

      常用命令:

  

命令说明
pm2 startup 设置pm2开机自启动
pm2 unstartup 移除pm2开机自启动
pm2 save 保存当前进程开机自启动
pm2 start <进程启动命令> [--name <进程名>] 启动应用程序
pm2 list 显示所有进程状态
pm2 monit 监控进程
pm2 logs [进程id或名字] 显示进程日志
pm2 stop [all] 停止[所有]进程
pm2 restart [all] 重启[所有]进程
pm2 delete [<进程名或者id>,all] 删除指定[所有]进程
pm2 info [进程id或名字] 查看应用程序信息

4、使用 pm2 守护 ASP.NET Core 应用程序

找到项目dll位置,执行命令: # pm2 start "dotnet testwebapi.dll" --name testwebapi
           检查是否成功: # curl http://localhost:5000
              查看日志: # pm2 logs testwebapi
       查看应用程序信息: # pm2 info testwebapi

4、使用 pm2 守护 node项目 应用程序

// 启动node web项目
pm2 start "node ./app.js" --name adminVue

停止进程:

// 1 是id
pm2 stop 1 

删除进程:

// 1是ID
pm2 delete  1

重启进程:

// 1是ID
pm2 restart  1
原文地址:https://www.cnblogs.com/shuaichao/p/12969140.html