Skip to content

No "shutdown" message is sent when the service is stopped #95

@gissahh

Description

@gissahh

Description

I have a service that should do some cleanup before stopping.

This way runs successful:

  1. pm2 is running as service
  2. in an admin console I start the service with pm2 start service.js --kill-timeout 10000 --shutdown-with-message
  3. in the admin console I enter manually pm2 stop all
  4. the service received successfully the shutdown message

But if instead of point 4 I stop the service with net stop pm2.exe, no message is sent to my service.

In the service I use this to catch the message:

process.on('message', msg => {
    if (msg === 'shutdown') {
        console.log('shutdown');
    }
});

Is there another way to do this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions