pm2

简明手册

Fork mode

CommandDescription
pm2 start app.js --name my-apiStart and name a process

Cluster mode

CommandDescription
pm2 start app.js -i 0Will start maximum processes with LB depending on available CPUs

Listing

CommandDescription
pm2 listDisplay all processes status
pm2 jlistPrint process list in raw JSON
pm2 prettylistPrint process list in beautified JSON
pm2 describe 0Display all information about a specific process
pm2 monitMonitor all processes

Logs

CommandDescription
pm2 logs [--raw]Display all processes logs in streaming
pm2 flushEmpty all log files
pm2 reloadLogsReload all logs

Actions

CommandDescription
pm2 stop allStop all processes
pm2 restart allRestart all processes
pm2 reload allWill 0s downtime reload (for NETWORKED apps)
pm2 stop 0Stop specific process id
pm2 restart 0Restart specific process id
pm2 delete 0Will remove process from pm2 list
pm2 delete allWill remove all processes from pm2 list
pm2 saveSave processes list to respawn at reboot

Misc

CommandDescription
pm2 reset <process>Reset meta data (restarted time...)
pm2 updatePM2Update in memory pm2
pm2 pingEnsure pm2 daemon has been launched
pm2 sendSignal SIGUSR2 my-appSend system signal to script
pm2 start app.js --no-daemonRun pm2 daemon in the foreground if it doesn't exist already
pm2 start app.js --no-vizionSkip vizion features (versioning control)
pm2 start app.js --no-autorestartDo not automatically restart app