[torqueusers] login-scripts within mom

Thomas Zeiser thomas.zeiser at rrze.uni-erlangen.de
Thu Dec 7 13:38:05 MST 2006


Hi Gerrick,

On Thu, Dec 07, 2006 at 01:11:38PM -0700, Garrick Staples wrote:
> > > > 
> > > > can I configure torque in a way that mom excecutes standard user
> > > > login-scripts on each computenode before starting the job (non interactive)?
> > > 
> > > Doesn't it already happen?  The initial process is started as the user's
> > > login shell.
> > 
> > that's true -- but depending on how the mom is compiled (cf.
> > http://www.clusterresources.com/pipermail/torqueusers/2006-October/004525.html)
> > new shells may be forked to actually execute the job script. And
> > these shells are no longer login shells (at least by default) and
> > thus do not get definitions of aliases or shell functions as e.g.
> > used by modulecmd.tcl ...
> 
> You don't need a login shell to get aliases and shell functions, or else
> you'd never be able to use them in a shell script.

passing environment variables through is no problem - but I do not
get aliases or shell functions passed through (and that's exactly
what you need for e.g. module load xyz):

unrz at woody1: 21:29 [~] > alias
unrz at woody1: 21:29 [~] > echo $SHELL
/bin/tcsh
unrz at woody1: 21:29 [~] > alias xx
unrz at woody1: 21:29 [~] > alias xx ls
unrz at woody1: 21:29 [~] > alias xx
ls
unrz at woody1: 21:29 [~] > tcsh
unrz at woody1: 21:29 [~] > alias xx


unrz at woody1: 21:31 [~] > bash
unrz at woody1:~> xx () { ls ; }
unrz at woody1:~> set|tail -n 4
xx () 
{ 
    /bin/ls $LS_OPTIONS
}
unrz at woody1:~> bash
unrz at woody1:~> set|grep xx
unrz at woody1:~> 


and of cource,  >ssing aliases (or shell functions) from tcsh to
bash/sh or vice versa does not work at all ...

> Login shells get you the initial set of environmental variables.  Since
> they are exportable, they should only be setup once.


thomas


More information about the torqueusers mailing list