Skip to content

Commit c32c52b

Browse files
committed
Jobutils: Add optional hook for taskwrapper termination
1 parent 72d2aaa commit c32c52b

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

Utilities/Tools/jobutils.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,17 @@ taskwrapper() {
239239
trap '' SIGTERM
240240

241241
o2_cleanup_shm_files #--> better to register a general trap at EXIT
242+
243+
# this gives some possibility to customize the wrapper
244+
# and do some special task at the ordinary exit. The hook takes 3 arguments:
245+
# - The original command
246+
# - the logfile
247+
# - the return code from the execution
248+
if [ "${JOBUTILS_JOB_ENDHOOK}" ]; then
249+
hook="${JOBUTILS_JOB_ENDHOOK} '$command' $logfile ${RC}"
250+
eval "${hook}"
251+
fi
252+
242253
return ${RC}
243254
}
244255

0 commit comments

Comments
 (0)