Skip to content

Instantly share code, notes, and snippets.

@perbu
Created September 9, 2019 05:40
Show Gist options
  • Select an option

  • Save perbu/a8484056541f40270ffbab4a27c67d41 to your computer and use it in GitHub Desktop.

Select an option

Save perbu/a8484056541f40270ffbab4a27c67d41 to your computer and use it in GitHub Desktop.

Revisions

  1. perbu created this gist Sep 9, 2019.
    7 changes: 7 additions & 0 deletions handler.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    function signalHandle(signal) {
    console.log('Received signal ', signal);
    server.em.emit("serverShutdown", "Shutdown initiated by signal "+signal);
    }

    process.on('SIGINT', signalHandle);
    process.on('SIGTERM', signalHandle);