Hi,
I have a (probably) stupid question.
I would linke to set-up an user environment for a certain project for users and then configure it accordingly.
The setup phase is usually done once and involves running a script which makes some changes to the filesystem.
Typically i will create some "standard" directory structures and link some files/directories to this structure.
Once the setup is complete, i need to configure the environment for using it.
This second part is easily dome with modules but i was wondering if there is any way to execute a script (that does not have environment settings) to check if a particular directory structure is in place.
If it is not there it will create it, otherwise it will just skip it and proceed to the configuration part.
Of course this first part would have just to be executed on a module load command and should not be reverted by a module unload or switch command.
Something like:
exec-shell-script bash ./path/to/script/Create.sh
(instead of bash it could be anything like another shell, a python script or even a program written by the user)
followed by some standard modulefile commands that set user environment variables.
A user would then alway call a single modulefile regardless of the fact that the directory structure is already in place.
Something like:
module load setup/ProjectXXX
If it is the first time it is run it will create the complete directory structure (with directories, links etc) and then setup the environment variables (tools, licenses, paths etc)
If the user runs it a second time the script would still be executed but being the directory structure already in place it would just skip that part (this is handled by the script itself) and go to the environment configuration part.
Of course, in case of a:
module unload setup/ProjectXXX
only the environment part would be undone and the whole directory structure would stay as before.
Of course this procedure has not to be a one step solution but it could well be one that reguires loading two different modules,
the first one that creates/checks the structure and a second one that configures the environment.
I tried to look if this is possible but did not find a solution.
Many thx in advance,
Roberto
|