From 6307d69ef1b22b16cd7bbda90932d24ff590475c Mon Sep 17 00:00:00 2001 From: Christoph Niethammer Date: Wed, 13 Mar 2013 11:01:32 +0000 Subject: [PATCH] Fixes log file conflicts if multiple users execute script on the same system. --- check_modules.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/check_modules.sh b/check_modules.sh index cc332f8..d57b5ec 100755 --- a/check_modules.sh +++ b/check_modules.sh @@ -20,11 +20,12 @@ IGreen='\e[0;92m' # Intense Green IRed='\e[0;91m' # Intense Red # intermediate files, logfiles +LOGDIR=${LOGDIR:=$PWD} TMP=${TMP:=/tmp} -logfile="check_modules.log" # logfile with detailed information -module_load_logfile="$TMP/.module_load.log" # output of 'module load commands -module_rm_logfile="$TMP/.module_rm.log" # output of 'module rm' commands -module_clean_env_file="$TMP/.module_clean_env" # original environment +logfile="$LOGDIR/check_modules.log" # logfile with detailed information +module_load_logfile="$TMP/.module_load.$$.log" # output of 'module load commands +module_rm_logfile="$TMP/.module_rm.$$.log" # output of 'module rm' commands +module_clean_env_file="$TMP/.module_clean_env.$$" # original environment # safe the original environment set > $module_clean_env_file