Easily register tasks to perform when the current node process exits.
npm install on-exit
Call onExit one or more times to add process cleanup tasks:
var onExit = ;;;
When the process exits handlers will be run in the order that they were added.
You can set a logging function if you would like to log kill signals and exit events:
var onExit =;// Or to console.logonExit;