From 6f49f870ed44f6306905236d37fd3577d3717886 Mon Sep 17 00:00:00 2001 From: FliegendeWurst <2012gdwu+github@posteo.de> Date: Sun, 25 Apr 2021 11:05:09 +0200 Subject: [PATCH] Exit on SIGTERM (#1891) Stopping the systemd service running the server now works properly. --- src/www | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/www b/src/www index ff8728408..f8a5e4b0b 100755 --- a/src/www +++ b/src/www @@ -8,10 +8,13 @@ process.on('unhandledRejection', error => { require('./services/log').info(error); }); -process.on('SIGINT', function() { - console.log("Caught interrupt signal. Exiting."); - process.exit(); -}); +function exit() { + console.log("Caught interrupt/termination signal. Exiting."); + process.exit(0); +} + +process.on('SIGINT', exit); +process.on('SIGTERM', exit); const { app, sessionParser } = require('./app'); const fs = require('fs');