Node.js process handle exit event
setInterval(function(){ console.log('hello'); }, 1000);/*from ww w . ja v a2 s .c o m*/ process.on('SIGINT', function(){ console.log('bye'); process.exit(0); });