Skip to content

Latest commit

 

History

History
56 lines (41 loc) · 709 Bytes

pm2.md

File metadata and controls

56 lines (41 loc) · 709 Bytes

PM2 Service

Start a service

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
    }]
}

Stop a service

pm2 stop 0

or

pm2 stop MyService

Show services

pm2 ls

Reset your service IDs

pm2 save ## To Save your current pm2 instance
pm2 kill
pm2 resurrect