kill background jobs on exit

This commit is contained in:
olli 2024-03-24 11:21:58 +01:00
parent 84d06df8e6
commit b93914b71f

View File

@ -30,11 +30,12 @@ g_tmp="$g_tmp/g_$g_scriptname-$$"
[ -d "$g_tmp" ] || mkdir -p "$g_tmp"
# START and EXIT Notification
g_trap_exit="g_logger EXITING $g_scriptname ; rm -r $g_tmp"
g_trap_exit="g_logger EXITING $g_scriptname ; rm -r $g_tmp ; g_kill_all_background_jobs"
trap "$g_trap_exit" EXIT
g_syslogtag="g_bash-script:$g_scriptname[$$]"
[ $g_scriptname = "bash" ] || g_logger STARTING $g_scriptname
# red STDERR output
exec 9>&2
exec 8> >(