Is it possible to intercept the default kill
signal and use it as a command for a graceful shutdown? This is for Solaris SMF. The easiest way to have a stoppable service that I have found is to set :kill
as the shutdown script and then to add a shutdown hook in Java. In this case, I want to do it for Node.JS. How should I do it?
Edit: The purpose is to
@alienhard's first suggestion was to use process.on('exit'...
but it seems that I would not be able to accomplish number 2 with this method.
The only thing that comes to my mind is using signal events.
http://nodejs.org/docs/v0.3.1/api/process.html#signal_Events