Hi,

Am 10.10.2014 um 10:55 schrieb Txema Heredia:

> One of my users is complaining that the $NSLOTS variable doesn't exist when 
> submitting qlogin jobs. The only info I've found regarding this is this 
> message from 2009:
> http://arc.liv.ac.uk/pipermail/gridengine-users/2009-November/027862.html
> 
> I have tested it in BASH, and it doesn't work. Neither ". 
> /var/spool/sge/$HOSTNAME/active_jobs/$MYJOBID.1/environment" nor "source 
> /var/spool/sge/$HOSTNAME/active_jobs/$MYJOBID.1/environment" load anything.

The purpose of the script below is to extract the job id, as it's the only way 
to get to the correct spool directory for the job. The plain commands above 
won't work hence.

`sourcing` the variables would in addition set them in the current shell only, 
but not exporting them.

-- Reuti


> It seems that, as the contents of the environment file are plain variable 
> definitions with no export command at all, nothing is done. The workaround 
> I've found is:
> 
> MYPARENT=`ps -p $$ -o ppid --no-header`
> MYSTARTUP=`ps -p $MYPARENT -o command --no-header`
> 
> if [ "${MYSTARTUP:0:13}" = "sge_shepherd-" ]; then
>    echo "Running inside SGE"
>    MYJOBID=${MYSTARTUP:13}
>    MYJOBID=${MYJOBID% -bg}
>    echo "Job $MYJOBID"
> 
>    for i in $(cat 
> /var/spool/sge/$HOSTNAME/active_jobs/$MYJOBID.1/environment); do
>        export ${i};
>    done
>    unset HISTFILE
> fi
> 
> 
> Does anyone have a "more elegant" way to do this?
> 
> Thanks in advance,
> 
> Txema
> _______________________________________________
> users mailing list
> [email protected]
> https://gridengine.org/mailman/listinfo/users


_______________________________________________
users mailing list
[email protected]
https://gridengine.org/mailman/listinfo/users

Reply via email to