For example, your job could change to the directory you were
working in at the
time of the qsub by having the following in your
script (remembering that by default a job starts execution in your home
directory):
cd "$PBS_O_WORKDIR"Bear in mind that you may want to use the same script to test things interactively before using qsub. In that case, be careful how you use these PBS variables, because they are undefined except within a running job. In the above example, if you follow its format exactly, including the double-quotes, there will be no change of directory except within a job, which is probably exactly what you want. if that's too subtle for your taste, just cd to the required directory explicitly!
Env Variable | Value | For example |
---|---|---|
PBS_O_HOME | HOME value at qsub time | /home/filer1/lowel |
PBS_O_HOST | Hostname at qsub time | escience1 |
PBS_O_INITDIR | set to the value of the qsub -d option directory | (undefined by default) |
PBS_O_LOGNAME | LOGNAME value at qsub time | lowel |
PBS_O_MAIL | MAIL value at qsub time | /var/mail/lowel |
PBS_O_PATH | PATH value at qsub time | /usr/local/bin:/bin:.... |
PBS_O_SHELL | SHELL value at qsub time | /bin/bash |
PBS_O_QUEUE | the name of queue to which the job was submitted | esq |
PBS_O_WORKDIR | the absolute current directory at qsub time | /home/filer1/lowel/proj1 |
PBS_ARRAYID | For job arrays (qsub -t), the assigned id for this job instance | 1 |
PBS_ENVIRONMENT | set to PBS_BATCH or to PBS_INTERACTIVE | PBS_BATCH |
PBS_JOBCOOKIE | a hexadecimal string unique to the job | (unpredictable) |
PBS_JOBID | the job identifier assigned by the batch system | 539.escience1 |
PBS_JOBNAME | the job name defaulted or given by the user (-N) |
mytest |
PBS_NODEFILE | the filename of nodelist file (main node script only) | /var/spool/pbs/aux/539.escience1 |
PBS_NODENUM |
0 for main or only node,
1:n-1 for others |
0 |
PBS_VNODENUM | Under pbsdsh: 0 to c-1
where c is the number of cores |
0 |
PBS_TASKNUM |
Under pbsdsh: a unique
task-instance counter |
2 |
PBS_QUEUE | name of the queue from which the job is executed | eslong |
PBS_ROOTDIR | For qsub -D, the system root dir for the job | /image/SL4 |