From daef0163d4fdb570bc1ab2fc3c9f64fcb06b584a Mon Sep 17 00:00:00 2001
From: Blaise Li <blaise.li__git@nsup.org>
Date: Wed, 29 Jan 2020 11:41:39 +0100
Subject: [PATCH] More verbose wrapper script.

Indicate original config file.
---
 run_pipeline.sh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/run_pipeline.sh b/run_pipeline.sh
index 38637d4..8660f68 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?
-- 
GitLab