LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   re-read modified /usr/share/Modules/init/.modulespath (https://www.linuxquestions.org/questions/linux-newbie-8/re-read-modified-usr-share-modules-init-modulespath-4175442844/)

s_siouris 12-24-2012 10:44 PM

re-read modified /usr/share/Modules/init/.modulespath
 
Hi all,

I want to add my own directory for modulefiles, such as /usr/local/share/Modules/modulefiles, and I am doing this by adding this directory in the text file /usr/share/Modules/init/.modulespath.

My problem is that when I do "module avail", it does not show the modulefiles of the new directory unless I reboot the system. What command can I run so that /usr/share/Modules/init/.modulespath is re-read without needing to reboot?


Many thanks,
Spiros

malekmustaq 12-25-2012 02:41 AM

If you want to have some modules read and loaded by the init at boot up the place where init looks into it is /etc/modprobe.d directory. Put everything you like there; at successful boot and load the modules are already reckoned by the system.

Hope that helps. Good luck.

s_siouris 12-25-2012 09:01 AM

Thanks for the reply. I can get things to work with a reboot, but my problem is I cannot figure out how to reload the .modulespath without reboot. Do you have any ideas on how to do this without reboot? I want to do this on a server so restarting the system is not an option unfortunatelly.

Thanks,
Spiros

malekmustaq 12-25-2012 11:43 AM

Use modprobe to insert or remove modules without need to reboot.

Code:

~$ modprobe -h
~$ man modprobe

That is what you are looking for.

Hope that helps.

Good luck.

m.m.

s_siouris 12-25-2012 12:05 PM

Thanks for your help!

Sorry but I was probably not clear enough. The modules I am refering to are for loading environment variables using the
Code:

module
command, and not kernel modules. When you type
Code:

module avail
in the shell, you ahould get something like:
Code:

------------------------ /usr/share/Modules/modulefiles ------------------------
dot          module-info  mpich2-x86_64 use.own
module-cvs    modules      null


I want to add my own additional directory where "module" searches, for example /home/spiros/Modules/modulefiles, so that when typing "module avail" it will list something lie this:

Code:

------------------------ /usr/share/Modules/modulefiles ------------------------
dot          module-info  mpich2-x86_64 use.own
module-cvs    modules      null
------------------------ /home/spiros/Modules/modulefiles ------------------------
my-own-modulefiles

To do this I need to add the /home/spiros/Modules/modulefiles directory to /usr/share/Modules/init/.modulespath but in order for the changes to take effect, I can only do this by rebooting. Is there a service I can stop/start, or any other command, so that the module command can re-read the /usr/share/Modules/init/.modulespath file without reboot?


Many thanks for your time,
Spiros

malekmustaq 12-25-2012 11:21 PM

Ah, I see, am sorry. It means you are using 'module' package.
Have you tried these already? --

Code:

module load
module add
module remove
module rm

If not then try
Code:

module help
If it is not about heavy duty tasks you can set your environment (e.g. $PATH) permanently at /etc/profile or $HOME/.bash_profile using "export", at least they are loaded automatically. You can fix that module path by exporting in the /$HOME/.bashrc or defining there your path, e.g. "PATH=$HOME/modules/path:$PATH" by this you are adding automatically your modules path into your basic bash $PATH. You can also create your own bin folder /$HOME/bin and put there a simple script that carries 'module' command to load and unload certain environments at will without need of rebooting.

Hope that helps.

Good luck.


All times are GMT -5. The time now is 12:32 AM.