catch SIGINT and SIGTERM events
This commit is contained in:
@@ -9,6 +9,14 @@ function die()
|
|||||||
}
|
}
|
||||||
export -f 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()
|
function error()
|
||||||
{
|
{
|
||||||
# Check the call is actually the result of an error
|
# Check the call is actually the result of an error
|
||||||
@@ -37,7 +45,6 @@ function error()
|
|||||||
# Trigger error function on error
|
# Trigger error function on error
|
||||||
trap error ${LINENO} ERR
|
trap error ${LINENO} ERR
|
||||||
|
|
||||||
|
|
||||||
# Print a backtrace
|
# Print a backtrace
|
||||||
function backtrace
|
function backtrace
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user