Skip to content

Instantly share code, notes, and snippets.

@lakinmohapatra
Last active January 9, 2022 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lakinmohapatra/11d571fd3bf88dd4d5cca979a06171bb to your computer and use it in GitHub Desktop.
Save lakinmohapatra/11d571fd3bf88dd4d5cca979a06171bb to your computer and use it in GitHub Desktop.
Create app.js
process.on('SIGINT', function(){ console.log("SIGINT"); terminate() });
process.on('SIGTERM', function(){ console.log("SIGTERM"); terminate() });
var string = "a";
var terminate = function(){
console.log("shuting down...");
string = "b";
setTimeout(function(){
console.log("Terminated!");
process.exit();
}, 1000 * 5);
}
setInterval(function(){
console.log(string);
}, 500)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment