Sample PBS Batch Submission Script

Note : To know all the options, please see the man page of qsub. You won't need all the options given in this page, this is only a sample script.

   #!/bin/csh
   #
   # file:    pbs.template
   #
   # purpose: template for PBS (Portable Batch System) script
   #
   # remarks: a line beginning with # is a comment;
   #          a line beginning with #PBS is a pbs command;
   #          assume (upper/lower) case to be sensitive;
   #
   # use:     submit job with
   #          qsub pbs.template
   #
   # job name (default is name of pbs script file)
   #PBS -N myjob
   #
   # resource limits: number of CPUs to be used
   #PBS -l ncpus=25
   #
   # resource limits: amount of memory to be used
   #PBS -l mem=213mb
   #
   # resource limits: max. wall clock time during which job can be running
   #PBS -l walltime=3:20:00
   #
   #
   # path/filename for standard output
   #PBS -o mypath/my.out
   #
   # path/filename for standard error
   #PBS -e mypath/my.err
   #
   # queue name, one of {default, special express}
   # The default queue, "default", need not be specified
   #PBS -q default
   #
   # group account (for example, g12345) to be charged
   #PBS -W group_list=g12345 
   #
   # files to be copied to execution server before script processing starts
   # usage: -W stagein=local-filename@remotehost:remote-filename
   #PBS -W stagein=my.input@msa01-h:runs/input/my.input
   #
   # files to be copied from execution server after script processing
   # usage: -W stageout=local-filename@remotehost:remote-filename
   #PBS -W stageout=my.output@msa01-h:runs/output/my.outout
   #
   # start job only after MMDDhhmm, where M=Month, D=Day, h=hour, m=minute
   # e.g., July 4th, 14:30
   #PBS -a 07041430
   #
   # send me mail when job begins
   #PBS -m b
   # send me mail when job ends  
   #PBS -m e
   # send me mail when job aborts (with an error)
   #PBS -m a
   # if you want more than one message, you must group flags on one line,
   # otherwise, only the last flag selected executes:
   #PBS -mba
   #
   # do not rerun this job if it fails
   #PBS -r n
   #
   # export all my environment variables to the job
   #PBS -V
   #
   #
   # Using PBS - Environment Variables
   # When a batch job starts execution, a number of environment variables are
   # predefined, which include:
   #
   #      Variables defined on the execution host.
   #      Variables exported from the submission host with
   #                -v (selected variables) and -V (all variables).
   #      Variables defined by PBS.
   #
   # The following reflect the environment where the user ran qsub:
   # PBS_O_HOST    The host where you ran the qsub command.
   # PBS_O_LOGNAME Your user ID where you ran qsub.
   # PBS_O_HOME    Your home directory where you ran qsub.
   # PBS_O_WORKDIR The working directory where you ran qsub.
   #
   # These reflect the environment where the job is executing:
   # PBS_ENVIRONMENT       Set to PBS_BATCH to indicate the job is a batch job, or
   #                 to PBS_INTERACTIVE to indicate the job is a PBS interactive job.
   # PBS_O_QUEUE   The original queue you submitted to.
   # PBS_QUEUE     The queue the job is executing from.
   # PBS_JOBID     The job's PBS identifier.
   # PBS_JOBNAME   The job's name.
   ###