PBS Environment Variables

PBS sets multiple environment variables at submission time. The following PBS variables are commonly used in batch scripts:

  • PBS_O_WORKDIR
    • PBS sets the environment variable PBS_O_WORKDIR to the directory where the batch job was submitted.
    • By default, a job starts in your home directory.
    • Include the following command in your script if you want it to start in the submission directory:
cd $PBS_O_WORKDIR
  • PBS_JOBID
    • PBS sets the environment variable PBS_JOBID to the job’s ID.
    • A common use for PBS_JOBID is to append the job’s ID to the standard output and error file(s), such as the following:
#PBS -o scriptname.o$PBS_JOBID
Last modified on October 14th, 2008 at 3:36 pm