Process manager CLI for running, reloading, scaling, and inspecting long-lived Node.js, Bun, and other app processes.
$npm install -g pm2
Agent Compatibility
JSON Output
Agent Skill
MCP Support
AI Analysis
PM2 is a daemon-backed process manager for keeping long-running app processes alive on a server, restarting them after failure, and reloading or scaling them without hand-rolling service scripts. It is mainly a host-level control layer for Node.js and Bun apps, but it can also supervise other interpreters and binaries.
What It Enables
- Start apps from a script or ecosystem file, keep them running, and restart or reload them after code or config changes.
- Scale Node.js or Bun services across CPU cores, inspect process state, and stream or query logs from one CLI.
- Persist process state across reboots with generated startup scripts or run apps under
pm2-runtimeinside containers.
Agent Fit
jlistreturns raw process data as JSON andlogs --jsonemits structured log and process-event lines, so agents can inspect host state and parse follow-up actions without screen scraping.- The command set is broad for host-level operations: start, stop, reload, scale, describe, save, startup, and runtime container entrypoints all work cleanly in shell scripts once PM2 is installed on the target machine.
- Fit is narrower for remote-service workflows because PM2 manages local daemon state under
~/.pm2, and commands likemonit,dashboard, orstartupare TTY-oriented or privilege-gated.
Caveats
- Commands act on the local machine's PM2 daemon and saved process list, so automation needs shell access to the host rather than just an API token.
- Structured output is partial:
jlistand JSON logs are useful, but several inspect flows still default to formatted text.