Linux command
pm2 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Start application
pm2 start [app.js]
Start with name
pm2 start [app.js] --name "[app_name]"
List processes
pm2 list
Stop process
pm2 stop [name|id]
Restart process
pm2 restart [name|id]
View logs
pm2 logs
Monitor processes
pm2 monit
说明
pm2 is a production process manager for Node.js applications. It keeps applications running continuously with automatic restart on crashes, built-in load balancing via cluster mode, and centralized log management. The tool provides a monitoring dashboard (monit), process listing, log viewing, and startup script generation for system boot persistence. It can manage multiple applications simultaneously, each with independent configurations for instances, environment variables, and restart strategies.
参数
- start _APP_
- Start application.
- stop _ID_
- Stop process.
- restart _ID_
- Restart process.
- list
- List processes.
- logs
- View logs.
- monit
- Monitor dashboard.
- --name _NAME_
- Process name.
FAQ
What is the pm2 command used for?
pm2 is a production process manager for Node.js applications. It keeps applications running continuously with automatic restart on crashes, built-in load balancing via cluster mode, and centralized log management. The tool provides a monitoring dashboard (monit), process listing, log viewing, and startup script generation for system boot persistence. It can manage multiple applications simultaneously, each with independent configurations for instances, environment variables, and restart strategies.
How do I run a basic pm2 example?
Run `pm2 start [app.js]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does start _APP_ do in pm2?
Start application.