diff --git a/run_pipeline.sh b/run_pipeline.sh index 38637d4768d05be93dba07f0f2b009c864841c55..8660f6855033410338c81f7b7dfe6dfbc1ba3702 100755 --- a/run_pipeline.sh +++ b/run_pipeline.sh @@ -77,14 +77,15 @@ output_dir=$(grep "output_dir" "${configfile}" | mawk '{print $NF}' | sed 's/,$/ mkdir -p ${output_dir} start_day=$(date +"%Y-%m-%d") log_base="${output_dir}/$(date +"%d%m%y_%Hh%Mm")" +> ${log_base}.log config_base=$(basename ${configfile}) config_snapshot="${output_dir}/${config_base}" -echo "Saving a local copy of the configuration in ${config_snapshot}" +echo "Saving a local copy of the configuration file ${configfile} in ${config_snapshot}" | tee -a ${log_base}.log cp -f ${configfile} ${config_snapshot} snakefile_base=$(basename ${snakefile}) snakefile_snapshot="${output_dir}/${snakefile_base}" -echo "Saving a local copy of the snakefile in ${snakefile_snapshot}" +echo "Saving a local copy of the snakefile in ${snakefile_snapshot}" | tee -a ${log_base}.log cp -f ${snakefile} ${snakefile_snapshot} kilobytes_tot=$(mawk '$1 == "MemTotal:" {print $2}' /proc/meminfo) @@ -99,7 +100,7 @@ megabytes_resource=$(echo "${kilobytes_tot} / 1100" | bc) # TODO: check that this works cmd="(cd ${output_dir}; snakemake -s ${snakefile_base} --configfile ${config_base} --resources mem_mb=${megabytes_resource} $@)" -echo ${cmd} > ${log_base}.log +echo ${cmd} | tee -a ${log_base}.log # https://unix.stackexchange.com/a/245610/55127 # https://stackoverflow.com/a/692407/1878788 # Migh make things too slow?