From d9ca7c31272cbe70919e9076078695557a31edd9 Mon Sep 17 00:00:00 2001 From: "Kasper D. Fischer" Date: Tue, 25 May 2021 13:22:39 +0200 Subject: [PATCH] Add support for pe_prolog and pe_epilog files Send all command line args to the files to be run Add script to remove empty *.pe* and *.po* files after running pe jobs Scripts expect this 11 commandline arguments: $pe_hostfile $host $job_owner $job_id $job_name $pe $pe_slots $queue $stdout_path $stderr_path $merge_stderr --- bin/pro-epilog_wrapper.sh | 2 +- pe_epilog.d/99-rm_empty_pe_logs.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100755 pe_epilog.d/99-rm_empty_pe_logs.sh diff --git a/bin/pro-epilog_wrapper.sh b/bin/pro-epilog_wrapper.sh index de18b01..0728e93 100755 --- a/bin/pro-epilog_wrapper.sh +++ b/bin/pro-epilog_wrapper.sh @@ -15,6 +15,6 @@ done FILESSORTED="$(echo ${FILES} | sort)" for FILE in ${FILESSORTED} ; do - ${FILE} || exit $? + ${FILE} $@ || exit $? done exit 0 diff --git a/pe_epilog.d/99-rm_empty_pe_logs.sh b/pe_epilog.d/99-rm_empty_pe_logs.sh new file mode 100755 index 0000000..e9247bc --- /dev/null +++ b/pe_epilog.d/99-rm_empty_pe_logs.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +## Delete the STDOUT and STDERR files (.o and .e) if they are empty +## ( we do not want to delete non-empty files, they may contain useful +## troubleshooting or debug information ... ) +## + +## input args: +# 1: $pe_hostfile +# 2: $host +# 3: $job_owner +# 4: $job_id +# 5: $job_name +# 6: $pe +# 7: $pe_slots +# 8: $queue +# 9: $stdout_path +# 10: $stderr_path +# 11: $merge_stderr + +stdout_path=${9} +stderr_path=${10} + +[ -r ${stdout_path} -a -f ${stdout_path} ] && [ ! -s ${stdout_path} ] && rm -f ${stdout_path} +[ -r ${stderr_path} -a -f ${stderr_path} ] && [ ! -s ${stderr_path} ] && rm -f ${stderr_path} + +exit 0 +