diff options
Diffstat (limited to 'glances/__init__.py')
-rw-r--r-- | glances/__init__.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/glances/__init__.py b/glances/__init__.py index 62f5b569..eb640487 100644 --- a/glances/__init__.py +++ b/glances/__init__.py @@ -2,7 +2,7 @@ # # This file is part of Glances. # -# SPDX-FileCopyrightText: 2022 Nicolas Hennion <nicolas@nicolargo.com> +# SPDX-FileCopyrightText: 2023 Nicolas Hennion <nicolas@nicolargo.com> # # SPDX-License-Identifier: LGPL-3.0-only # @@ -19,7 +19,7 @@ import sys # Global name # Version should start and end with a numerical char # See https://packaging.python.org/specifications/core-metadata/#version -__version__ = '3.3.1.1' +__version__ = '3.4.0' __author__ = 'Nicolas Hennion <nicolas@nicolargo.com>' __license__ = 'LGPLv3' @@ -61,7 +61,7 @@ if PY3: def __signal_handler(signal, frame): - """Callback for CTRL-C.""" + logger.debug("Signal {} catched".format(signal)) end() @@ -74,7 +74,7 @@ def end(): # ...after starting the server mode (issue #1175) pass - logger.info("Glances stopped (key pressed: CTRL-C)") + logger.info("Glances stopped gracefully") # The end... sys.exit(0) @@ -156,8 +156,9 @@ def main(): Select the mode (standalone, client or server) Run it... """ - # Catch the CTRL-C signal - signal.signal(signal.SIGINT, __signal_handler) + # Catch the kill signal + for sig in (signal.SIGTERM, signal.SIGINT, signal.SIGHUP): + signal.signal(sig, __signal_handler) # Log Glances and psutil version logger.info('Start Glances {}'.format(__version__)) |