Use PM2 :
PM2 is daemon process manager that will help you manage and keep your application online. Getting started with PM2 is straightforward, it is offered as a simple and intuitive CLI, installable via NPM.
Installation
The latest PM2 version is installable with NPM or Yarn:
$ npm install pm2 -g
Start an app
The simplest way to start, daemonize and monitor your application is by using this command line:
$ pm2 start app.js //or
$ pm2 start server.js
List all processes
$ pm2 list
List all processes
The simplest way to start, daemonize and monitor your application is by using this command line:
$ pm2 list
Managing processes
Managing application state is simple here are the commands:
$ pm2 restart app_name
$ pm2 reload app_name
$ pm2 stop app_name
$ pm2 delete app_name
Instead of app_name
you can pass:
all
to act on all processesid
to act on a specific process id