[torqueusers] login-scripts within mom
dgolden at cp.dias.ie
Sat Dec 9 06:56:46 MST 2006
Kind of digressing from torque a bit but:
/bin/sh has a serious problem in conjunction with modules
in that the unix standard actually forbids it to load any
custom init in certain situations IIRC. This, and various workarounds
are IIRC documented somewhere in the modules docs.
This has become more of an issue as gnu bash, which typically
(though not necessarily) implments /bin/sh on linux, has become much
more standards-compliant when called as /bin/sh out-of-box recently
(case of being careful what you ask for, you just might get it...).
However, I use modules on our cluster, I basically try to make
as sure as possible short of nontrivially patching the shell source code
to get the setup done.
Note that modules should be written with idempotency in mind,
so usually the only real effect of accidentally doing
the init twice is potential slowdown. Given our cluster nodes
are multi-ghz and jobs run for hours to days, this is negligible....
(a) I tell users to use bash, ksh or csh over plain sh. This
is kind of bad of me, as it leads them to gratuitous bashisms sometimes...
(b) I actually recompile Redhat bash rpm to support /etc/bash.bashrc.
This is off on Redhat but on on many other linux distros, and
is sourced at init (see bash manual).
redhat:/etc/bashrc just _looks_ like it's just an aesthetically
renamed /etc/bash.bashrc. It's *not*, it's only ever "manually"
sourced from ~/.profile and such.
(c) I set $ENV to point to a file /etc/shrc, and $BASH_ENV to
/etc/bashrc in init scipts and with pam_env
/etc/shrc is a small discriminator file, as various sh-oid shells use
ENV - it checks the shell variant and sources the appropriate
real rc, e.g. /etc/kshrc for ksh or /etc/bashrc for bash and
(d) I provide /etc/modules.sh and /etc/modules.csh files
that do the actual normal module setup, that the various shell init
scripts source. As a last resort, this allows me to tell users
to manually source the file.
More information about the torqueusers