bash - How to use environment modules in a ssh command line? -
the environment modules package used dynamic modification of user's environment (debian package environment-modules).
i use module directly ssh command line. purpose able execute commands on different nodes bash script executed on front node. don't want explicitly update path , ld_library_path environment variables each different node configuration.
when directly connect node , call module node, working:
jyvet> ssh mynode jyvet@mynode> module load gcc-6.0 jyvet@mynode> gcc --version gcc (gcc) 6.0.1 but following approach fails:
jyvet> ssh mynode "module load gcc-6.0; gcc --version" command not found: module gcc-4.8 (debian 4.8.4-1) 4.8.4
module initialized /etc/profile.d/modules.sh called /etc/profile (which sets environment variables @ startup of shell).
the ssh command execution shell non-interactive shell , neither call /etc/profile, nor read config files.
here solution:
jyvet> ssh mynode "source /etc/profile; module load gcc-6.0; gcc --version" gcc (gcc) 6.0.1
Comments
Post a Comment