Search code examples
perlsungridengine

Determine if script is running in SGE


How can I determine from a Perl script if it's running through SGE or locally from the command line?


Solution

  • From http://www.cbi.utsa.edu/sge_tutorial:

    When a Sun Grid Engine job is run, a number of variables are preset into the
    job’s script environment, as listed below.
    
    SGE_ROOT - The Sun Grid Engine root directory as set for sge_execd before
       start-up or the default /usr/SGE
    SGE_CELL - The Sun Grid Engine cell in which the job executes
    SGE_JOB_SPOOL_DIR - The directory used by sge_shepherd(8) to store jobrelated
       data during job execution
    ...
    ...
    

    Checking %ENV should tell you if it is run through SGE.