On Fri, Aug 31, 2012 at 8:01 PM, NodeNinja <[email protected]> wrote:
> At some point in my node script that is running on the server I need to shut
> it down so I have done this line of code
>
>
> process.kill(process.pid, 'SIGTERM');
>
> This i guess will shutdown self
>
> then in the emitted event
>
> process.on('SIGTERM', function () {
> // close the server, it will stop accepting new connections and eventually
> shutdown
> server.close();
> });
>
> and  finally in
>
> // server close event
> server.on('close', function(){
> console.log('[server closed. . .' + port + ']');
> });
>
> I was wondering will the server really shutdown with all the clients still
> connected to it.
> How do I know that all client requests have completed and then gracefully
> tell the clients to disconnect and then shutdown the server.
>
> Also what about any async fileIO, pending requests etc. will the kill with
> 'SIGTERM' wait for all these to complete before it finally shutsdown the
> server?

Yes, unless you call process.exit().

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

Reply via email to