mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-29 18:13:16 -04:00
Handle SIGTERM messages
This commit is contained in:
parent
8b0b70e757
commit
fd53541719
1 changed files with 9 additions and 0 deletions
|
@ -263,6 +263,15 @@ var App = function() {
|
||||||
this.stop();
|
this.stop();
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* We also need to listen to SIGTERM signals so we stop everything when we are asked to stop by the OS.
|
||||||
|
*/
|
||||||
|
process.on("SIGTERM", () => {
|
||||||
|
console.log("[SIGTERM] Received. Shutting down server...");
|
||||||
|
setTimeout(() => { process.exit(0); }, 3000); // Force quit after 3 seconds
|
||||||
|
this.stop();
|
||||||
|
process.exit(0);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = new App();
|
module.exports = new App();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue