More secure way to prevent conflicts if multiple user execute script on the same system.
This commit is contained in:
parent
6307d69ef1
commit
ded7002f59
1 changed files with 6 additions and 4 deletions
|
@ -21,11 +21,12 @@ IRed='\e[0;91m' # Intense Red
|
||||||
|
|
||||||
# intermediate files, logfiles
|
# intermediate files, logfiles
|
||||||
LOGDIR=${LOGDIR:=$PWD}
|
LOGDIR=${LOGDIR:=$PWD}
|
||||||
TMP=${TMP:=/tmp}
|
tmpdir=/tmp/check_modules-$USER
|
||||||
|
mkdir -p $tmpdir
|
||||||
logfile="$LOGDIR/check_modules.log" # logfile with detailed information
|
logfile="$LOGDIR/check_modules.log" # logfile with detailed information
|
||||||
module_load_logfile="$TMP/.module_load.$$.log" # output of 'module load commands
|
module_load_logfile="$tmpdir/.module_load.log" # output of 'module load commands
|
||||||
module_rm_logfile="$TMP/.module_rm.$$.log" # output of 'module rm' commands
|
module_rm_logfile="$tmpdir/.module_rm.log" # output of 'module rm' commands
|
||||||
module_clean_env_file="$TMP/.module_clean_env.$$" # original environment
|
module_clean_env_file="$tmpdir/.module_clean_env" # original environment
|
||||||
|
|
||||||
# safe the original environment
|
# safe the original environment
|
||||||
set > $module_clean_env_file
|
set > $module_clean_env_file
|
||||||
|
@ -105,6 +106,7 @@ done
|
||||||
|
|
||||||
# clean up file storing the initial environment
|
# clean up file storing the initial environment
|
||||||
rm -f $module_clean_env_file
|
rm -f $module_clean_env_file
|
||||||
|
rm -rf $tmpdir
|
||||||
|
|
||||||
|
|
||||||
echo "----------------------------------------"
|
echo "----------------------------------------"
|
||||||
|
|
Loading…
Reference in a new issue