r-spatialecology / gwdg_hpc_guide

Guide How to use the GWDG HPC
https://r-spatialecology.github.io/gwdg_hpc_guide/
2 stars 0 forks source link

.bashrc and .profile #2

Closed mhesselbarth closed 5 years ago

mhesselbarth commented 5 years ago

It seems like .profile is not needed any more for SLURM and .bashrc can be streamlined

# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi 

module load gcc
module load zeromq
module load R_GEO
mhesselbarth commented 5 years ago

Update...I'm now using .profile to enable using .bashrc on Scientific Linux Link.

case "$SHELL" in
/bin/bash)
    . /etc/bashrc
    . .bashrc
    ;;
/usr/bin/bash)
    . /etc/bashrc
    . .bashrc
    ;;
/usr/local/bin/bash)
    . /etc/bashrc
    . .bashrc
    ;;
*)  ;;
esac

This allows me in my .bashrc to source .bash_modules to load all modules and .bash_aliases (#3) to load some aliases.

# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

# load aliases
if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# load modules
if [ -f ~/.bash_modules ]; then
    . ~/.bash_modules
fi

Finally, I load all modules in .bash_modules.

module load gcc
module load zeromq
module load R_GEO

One the first glance, this might seem a bit complicated, however, I think this keeps everything quite organized.

mhesselbarth commented 5 years ago

Updated on homepage