美文网首页
pm2相关命令

pm2相关命令

作者: 小晨主 | 来源:发表于2017-10-11 14:29 被阅读0次

GitHub地址 Unitech/pm2

# General
$ npm install pm2 -g            # Install PM2
$ pm2 start app.js              # Start, Daemonize and auto-restart application (Node)
$ pm2 start app.py              # Start, Daemonize and auto-restart application (Python)
$ pm2 start npm -- start        # Start, Daemonize and auto-restart Node application

# Cluster Mode (Node.js only)
$ pm2 start app.js -i 4         # Start 4 instances of application in cluster mode
                                # it will load balance network queries to each app
$ pm2 reload all                # Zero Second Downtime Reload
$ pm2 scale [app-name] 10       # Scale Cluster app to 10 process

# Process Monitoring
$ pm2 list                      # List all processes started with PM2
$ pm2 monit                     # Display memory and cpu usage of each app
$ pm2 show [app-name]           # Show all information about application

# Log management
$ pm2 logs                      # Display logs of all apps
$ pm2 logs [app-name]           # Display logs for a specific app
$ pm2 logs --json               # Logs in JSON format
$ pm2 flush
$ pm2 reloadLogs

# Process State Management
$ pm2 start app.js --name="api" # Start application and name it "api"
$ pm2 start app.js -- -a 34     # Start app and pass option "-a 34" as argument
$ pm2 start app.js --watch      # Restart application on file change
$ pm2 start script.sh           # Start bash script
$ pm2 start app.json            # Start all applications declared in app.json
$ pm2 reset [app-name]          # Reset all counters
$ pm2 stop all                  # Stop all apps
$ pm2 stop 0                    # Stop process with id 0
$ pm2 restart all               # Restart all apps
$ pm2 gracefulReload all        # Gracefully reload all apps in cluster mode
$ pm2 delete all                # Kill and delete all apps
$ pm2 delete 0                  # Delete app with id 0

# Startup/Boot management
$ pm2 startup                   # Detect init system, generate and configure pm2 boot on startup
$ pm2 save                      # Save current process list
$ pm2 resurrect                 # Restore previously saved processes
$ pm2 unstartup                 # Disable and remove startup system

$ pm2 update                    # Save processes, kill PM2 and restore processes
$ pm2 generate                  # Generate a sample json configuration file

# Deployment
$ pm2 deploy app.json prod setup    # Setup "prod" remote server
$ pm2 deploy app.json prod          # Update "prod" remote server
$ pm2 deploy app.json prod revert 2 # Revert "prod" remote server by 2

# Module system
$ pm2 module:generate [name]    # Generate sample module with name [name]
$ pm2 install pm2-logrotate     # Install module (here a log rotation system)
$ pm2 uninstall pm2-logrotate   # Uninstall module
$ pm2 publish                   # Increment version, git push and npm publish

相关文章

  • 常用Linux命令

    命令行 pm2 相关 pm2启动 和 npm 启动 git 相关 退出git log git commit 忽略触...

  • 宝塔面板-计划任务-pm2

    在宝塔里的计划任务写pm2命令直接写pm2命令会提示pm2不存在 先whereis pm2 找到目标路径在shel...

  • CentOS7使用pm2守护进程自启动

    找到项目的目录,使用pm2进行启动 执行命令pm2 start 进行启动 保存当前列表 执行命令pm2 save保...

  • pm2

    PM2 node与PM2 PM2命令 配置文件的方式启动:process.ymlapps: - script: ...

  • 服务器使用pm2运行npm run start 也可用于运行t

    命令:pm2 start npm -- run start 语法:pm2 start npm --watch --...

  • git&pm2&npm 命令

    pm2命令 命令含义pm2 stop id/name暂停ps aux | grep node查看node进程pm2...

  • pm2

    官方文档 常用 pm2命令: 1. 启动 # pm2 start app.js # pm2 start app.j...

  • pm2使用心得

    常用命令: install: npm install pm2 -g start: pm2 start ./bin/...

  • 在linux环境PM2使用

    安装PM2 安装后启动需要启动的脚本 pm2 start 执行文件 如: PM2简单的管理命令 生成PM2配置文件...

  • pm2 常用命令

    pm2 常用命令记录

网友评论

      本文标题:pm2相关命令

      本文链接:https://www.haomeiwen.com/subject/borwyxtx.html