LinuxCommandLibrary

pm2

TLDR

Start application

$ pm2 start [app.js]
copy
Start with name
$ pm2 start [app.js] --name "[app_name]"
copy
List processes
$ pm2 list
copy
Stop process
$ pm2 stop [name|id]
copy
Restart process
$ pm2 restart [name|id]
copy
View logs
$ pm2 logs
copy
Monitor processes
$ pm2 monit
copy

SYNOPSIS

pm2 [command] [options]

DESCRIPTION

pm2 is Node.js process manager. Production process management.
The tool handles clustering, logs, and monitoring. Auto-restart on crash.
pm2 manages Node.js apps.

PARAMETERS

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.

CAVEATS

Node.js specific. Requires npm install. Daemon-based.

HISTORY

PM2 was created for production Node.js process management.

SEE ALSO

node(1), forever(1), nodemon(1)

Copied to clipboard