# start and add a process to your list pm2 start app.js
# show your list pm2 ls
# stop and delete a process from the list # Default process name is the filename without .js (eg: app for app.js). # Use --name or -n to change. pm2 delete app
# stop the process (kill the process but keep it in the process list) pm2 stop app
# start the process pm2 start app
# both stop and start pm2 restart app
# Use reload instead of restart for 0-seconds downtime reloads: pm2 reload app
# To have more details on a specific application: pm2 describe <id|app_name>
# To monitor logs, custom metrics, application information: pm2 monit
# logs pm2 logs
# PM2 can generates and configure a Startup Script to keep PM2 and your processes alive at every server restart. # PM2可以生成和配置启动脚本,以在每次服务器重新启动时保持PM2和您的进程活动。 $ pm2 startup # Generate Startup Script $ pm2 save # Freeze your process list across server restart $ pm2 unstartup # Remove Startup Script
# Updating PM2 $ npm install pm2@latest -g # Install latest PM2 version $ pm2 update # Save process list, exit old PM2 & restore all processes