PM2 production process manager for Node.js applications

By | June 19, 2019

I have created a FedEx tracking system using Nodejs (  This is my first project with NodeJs ), while I moved to the server faced strange issues after some time my app js automatically getting terminated … To solve this, as usual googled, many peoples are suggested to use PM2.

PM2 packages are also available in npm so it is easy to install.

PM2 can Install using below command

$ npm install pm2 -g

Start an application
pm2 start monitored and kept alive forever, my app name named as server.js and it syntax

$ pm2 start server.js

After using the above command my app get started and it started to working fine

Also updating few commands with PM2 it will be useful for mange
List command
Using bellow syntax you can view the list of apps using PM2

$ pm2 list

Commands for Managing apps

$ pm2 stop     
$ pm2 restart  
$ pm2 delete   
$ pm2 reload all

Command itself explains the use, above syntax, can help to manage your apps,

To monitor your app can use bellow command

$ pm2 monit

It will display like below image

To check the logs,

$ pm2 logs

After typing log command

It has many commands please use below links to view more
PM2 CheatSheet: https://pm2.io/doc/en/runtime/features/commands-cheatsheet/

Leave a Reply

Your email address will not be published. Required fields are marked *