From 076a12b770ec1e1631fd076731dadeaa65ee4449 Mon Sep 17 00:00:00 2001 From: fatalerrors Date: Fri, 18 Jun 2021 11:01:20 +0200 Subject: [PATCH] catch SIGINT and SIGTERM events --- lib/aaa_errors.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/aaa_errors.sh b/lib/aaa_errors.sh index 5aaabfb..6cc7a7f 100644 --- a/lib/aaa_errors.sh +++ b/lib/aaa_errors.sh @@ -9,6 +9,14 @@ function die() } export -f die +function terminate() +{ + prnt E "$1 reçu, sortie immédiate." + die 128 +} +trap terminate 'Ctrl + C' SIGINT +trap terminate 'SIGTERM' SIGTERM + function error() { # Check the call is actually the result of an error @@ -37,7 +45,6 @@ function error() # Trigger error function on error trap error ${LINENO} ERR - # Print a backtrace function backtrace {