diff options
author | Jonathan Bauer | 2019-07-10 14:49:10 +0200 |
---|---|---|
committer | Jonathan Bauer | 2019-07-10 14:49:10 +0200 |
commit | 520560505cb22616440b6e5459fd9c79eec734a3 (patch) | |
tree | 6745247c711250be5d4c286ab89f8a7894317d02 /core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc | |
parent | [vmware-common] Actually pass some file to grep... (diff) | |
download | mltk-520560505cb22616440b6e5459fd9c79eec734a3.tar.gz mltk-520560505cb22616440b6e5459fd9c79eec734a3.tar.xz mltk-520560505cb22616440b6e5459fd9c79eec734a3.zip |
[run-virt] improve signal traps handling
Diffstat (limited to 'core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc')
-rw-r--r-- | core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc index aaace562..f049642d 100644 --- a/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc +++ b/core/modules/run-virt/data/opt/openslx/vmchooser/run-virt-includes/vmchooser_runvirt_functions.inc @@ -120,6 +120,7 @@ add_cleanup() { # EXIT_REASON should contain a user-friendly message to print to the user. # it can be prefixed with err.\S+, which will serve as a translation identifier cleanexit() { + trap "" SIGHUP SIGINT SIGTERM EXIT writelog "Cleanexit '$1' triggered by '${BASH_SOURCE[1]}:${FUNCNAME[1]}'" sleep 1 while isset CLEANUP_TASKS; do @@ -134,6 +135,9 @@ cleanexit() { fi done + # kill potential remaining background jobs + kill $(jobs -p) + # If we're not in debug mode, remove all temporary files if notempty SLX_DEBUG && isset TMPDIR; then rm -rf -- "${TMPDIR}" @@ -174,12 +178,6 @@ cleanexit() { ERR_TEXT="Unbekannter Fehler" fi - # first send the logfile (in case the user does not close the error before using magic keys e.g.) - # for any other error types besides 'user'. Do no slxlog if we run wrapped (from /opt/openslx/scripts/vmchooser-run_virt) - if [ "x${EXIT_TYPE}" != "xuser" ]; then - writelog "Critical error happened in '${BASH_SOURCE[1]}:${FUNCNAME[1]}'" - fi - # finally display the error error_user "${ERR_TITLE}" " ${ERR_TEXT} |