From 7803b7a57be30435a4764f62428c7daa340be0d9 Mon Sep 17 00:00:00 2001 From: Blaise Li <blaise.li__git@nsup.org> Date: Mon, 30 Apr 2018 16:14:36 +0200 Subject: [PATCH] Logging pipeline output. --- run_pipeline.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/run_pipeline.sh b/run_pipeline.sh index ad6a528..a70d0ab 100755 --- a/run_pipeline.sh +++ b/run_pipeline.sh @@ -68,7 +68,13 @@ then else error_exit "Pipeline configuration file ${configfile} not found." fi -echo ${cmd} -eval ${cmd} || error_exit "${cmd} failed" + +# Determine the output directory and where to log the pipeline +output_dir=$(grep "output_dir" "${configfile}" | mawk '{print $NF}' | sed 's/,$//' | sed 's/"//g') +mkdir -p ${output_dir} +log_base="${output_dir}/$(date +"%d%m%y_%Hh%Mm")" +echo ${cmd} > ${log_base}.log +# https://stackoverflow.com/a/692407/1878788 +eval ${cmd} > >(tee -a ${log_base}.log) 2> >(tee -a ${log_base}.err >&2) || error_exit "${cmd} failed" exit 0 -- GitLab