[GE users] Setting TMPDIR for interactive sessions over SSH.

reuti reuti at staff.uni-marburg.de
Wed Feb 3 10:53:19 GMT 2010

Am 02.02.2010 um 18:55 schrieb kisielk:

> Has anyone come up with a way to set the TMPDIR environment  
> variable for interactive sessions?
> My interactive sessions are configured as follows:
> qlogin_command               /usr/local/bin/ssh_wrapper
> qlogin_daemon                /usr/sbin/sshd -i
> rlogin_command               /usr/bin/ssh -Y
> rlogin_daemon                /usr/sbin/sshd -i
> rsh_command                  /usr/bin/ssh -Y
> rsh_daemon                   /usr/sbin/sshd -i
> (where ssh_wrapper is basically ssh -Y -p $2 $1)
> It seems sge_execd still creates the temporary directory, but I  
> can't figure out a way to inform the user environment of its location.

As you get a fresh shell, no environent variable is set. What you can  
do, is to check the parents of the actual session in your ~/.profile  
or alike:

MYPARENT=`ps -p $$ -o ppid --no-header`
MYPARENT=`ps -p $MYPARENT -o ppid --no-header` # These two lines only  
for ssh
MYPARENT=`ps -p $MYPARENT -o ppid --no-header` # These two lines only  
for ssh
MYSTARTUP=`ps -p $MYPARENT -o command --no-header`

if [ "${MYSTARTUP:0:13}" = "sge_shepherd-" ]; then
    echo "Running inside SGE"
    echo "Job $MYJOBID"

    . /var/spool/sge/$HOSTNAME/active_jobs/$MYJOBID.1/environment
    unset HISTFILE

With this snippet you get:

reuti at pc15370:~> qrsh
Last login: Wed Feb  3 11:48:21 2010 from pc15370.chemie.uni-marburg.de
Have a lot of fun...
Running inside SGE
Job 411
reuti at pc15381:~> echo $TMPDIR

For the builtin startup leave the two assignments of MYPARENT out. A  
generic solution would just parse the complete proecss tree up to one  
without parent.

-- Reuti

> ------------------------------------------------------
> http://gridengine.sunsource.net/ds/viewMessage.do? 
> dsForumId=38&dsMessageId=242674
> To unsubscribe from this discussion, e-mail: [users- 
> unsubscribe at gridengine.sunsource.net].


To unsubscribe from this discussion, e-mail: [users-unsubscribe at gridengine.sunsource.net].

More information about the gridengine-users mailing list