Is there any events before restarting a server?


#1

Hi.

My app uses an external sub process that is communicating with Meteor app server.
You know that the server restarts when you update the server-side code of Meteor app.
And I found that this restart does not kill the sub process.
So I need to kill the sub process by my code before restarting the server.

Is there any events that can be listened just before restarting a server?


#2

I found a solution by chance.

Node process that meteor works on receives SIGTERM before auto restart.

So the following code works.

process.on('SIGTERM', function() {
    /* any gentle shut down procedures */
    process.exit(1);
});