So I am trying to have module files dynamically load/unload when you load one. I am trying to do this in a way so that I can unload conflicting modules (instead of just using the conflict variable as it just throws an error)
However, when I call module load on one file that tries to unload another... the second one is loaded instead of unloaded. Example is below:
test1 Modulefile:
#%Module1.0
##
## Testing
##
if { [module-info mode load] && [is-loaded test2] } {
puts stderr "Unloading test2 (From test1)"
module unload test2
}
test2 Modulefile:
#%Module1.0
##
## Test2
##
if { [module-info mode load] } {
puts stderr "Loading test2\n"
}
if { [module-info mode remove] } {
puts stderr "Unloading test2\n"
}
Output when I try to load test1 while test2 is loaded:
root@host:/usr/local/modules# module load test1
Unloading test2 (From test1)
Loading test2
module --version output:
VERSION=3.2.10
DATE=2012-12-21
AUTOLOADPATH=undef
BASEPREFIX="/usr"
BEGINENV=99
CACHE_AVAIL=undef
DEF_COLLATE_BY_NUMBER=undef
DOT_EXT=""
EVAL_ALIAS=1
HAS_BOURNE_FUNCS=1
HAS_BOURNE_ALIAS=1
HAS_TCLXLIBS=undef
HAS_X11LIBS=1
LMSPLIT_SIZE=1000
MODULEPATH="/usr/share/modules/modulefiles"
MODULES_INIT_DIR="/usr/Modules/3.2.10/init"
PREFIX="/usr/Modules/3.2.10"
TCL_VERSION="8.6"
TCL_PATCH_LEVEL="8.6.1"
TMP_DIR="/tmp"
USE_FREE=undef
VERSION_MAGIC=1
VERSIONPATH="/usr/share/modules/versions"
WANTS_VERSIONING=1
WITH_DEBUG_INFO=undef
Does anyone know why or how I can fix this? Is there another command that I can put in the Modulefile that unloads another module? Or is there an better alternative to using Modules?
Thanks in advanced for reading and helping!