Here is an essentially blank PBS script template with the most commonly used PBS directives entered and ready to be completed.

You can copy and paste the text into a file and complete each of the options that begin with #PBS in a way that is appropriate for your account and job. See the table of annotations below for explanations of how to fill in the blanks for each option.

This template is meant, at least in part, to familiarize you with the options and their functions while providing you a starting place for a personalized template. We recommend that you take the time to read the annotations and fill in the template.

For an example of a completed PBS script for an imaginary user, see the main Torque web page.

This page does not cover all the PBS options, only the most commonly used. See the other topics pages on the main Torque web page for examples of submitting interactive batch jobs, job arrays, etc.

The template

####  PBS preamble
#PBS -N 

#PBS -M 
#PBS -m ea
#PBS -j oe

#PBS -A 
#PBS -q 

#PBS -l 

####  End PBS preamble

# You may wish to note in comments here whether any software modules
# should be loaded prior to submitting this script, as a reminder to
# yourself and anyone else who may inherit this script.

if [ -s "$PBS_NODEFILE" ] ; then
    echo "Running on"
    uniq -c $PBS_NODEFILE

if [ -d "$PBS_O_WORKDIR" ] ; then
    echo "Running from $PBS_O_WORKDIR"

# Put commands to run during the batch job below this line


The following table explains each of the options in the blank template above. The #PBS is not included, only the option that follows the directive.

-N The -N option specifies the job name. This will be displayed by, for example, the qstat command to see the job status.
-M The -M option specifies the e-mail address to which notice of events related to this job are sent. More than one address can be used, separated by commas (no spaces).
-m The -m option specifies the events for which you want notification. They are: abort, begin, and end.
-j oe Without the -j option, whatever the job prints to STDOUT will go in one file and whatever the job prints to STDERR will go in another.The -j option says to join the two and put everything into the job output file (not to be confused with output that your programs may write). If you specify -j eo the two will be joined and put into the
error file. Practically, these are the same except for the name of the file.
-A The -A option specifies the account to use; that is, how will the job be paid. Different types of Flux services have different suffixes. For example, a standard Flux account will end with _flux, whereas one that pays for use of the large-memory Flux service would end with _fluxm.
-q The -q option specifies which queue your job will be in. If the account ends in _flux, then -q must specify flux. If the account ends with some variation, say, default_fluxm, then the queue name must match, e.g., _fluxm.
-V The -V option specifies that the environment at the time the job is submitted should be inherited by your job. So, you will load software modules and other system variables during your login session on the login node before you submit your job.You should always set up your environment prior to running qsub and use the -V option.