pm2 start index.js --name MyNewService
or
pm2 start ecosystem.config.js
With a file like this:
// ecosystem.config.js File
module.exports = {
apps: [{
name: "MyNewService",
script: "./index.js",
error_file: "./--error",
out_file: './out.log',
log_date_format: 'YYYY-MM-DD HH:mm:ss:SSS',
cwd: "./" // Path to directory where package.json is located
}]
}
pm2 stop 0
or
pm2 stop MyService
pm2 ls
pm2 save ## To Save your current pm2 instance
pm2 kill
pm2 resurrect