Hi, to make my service to do graceful shutdown,

I'm trying to write signal handler for worker processes(to flush buffered 
internal logs to external log server, etc.)

but they just dies without signal handling. I don't know why and how to fix 
this issue.

but code below is example. try running it and kill it(not Ctrl-C, use `kill 
[pid]`)

var cluster = require('cluster');
>
> if (cluster.isMaster) {
>   cluster.fork();
>   function handleExit() {
>     var id, w;
>     for (id in cluster.workers) {
>       w = cluster.workers[id];
>       w.kill('SIGTERM');
>     }
>   };
>   process.on('SIGTERM', handleExit);
>   process.on('SIGINT', handleExit);
>   return;
> }
>
> setInterval(function() {
>   console.log('alive');
> }, 1000);
>
> process.on('SIGQUIT', function() {
>   console.log('SIGQUIT');
> });
>
> process.on('SIGTERM', function() {
>   console.log('SIGTERM!!!!');
> });
>
> process.on('SIGINT', function() {
>   console.log('SIGINT!!!');
> });
>
> process.on('exit', function() {
>   console.log('EXIT!!!');
> });
>
> process.on('message', function(msg) {
>   console.log("Got Message " + msg);
> });
>


-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to