Platform LSF Administration Guide Version 6.2

Writing Job Scripts
Administering Platform LSF
526
%
bsub < myscript
Job <1234> submitted to queue <test>.
In this example, the myscript file contains job submission options as well as
command lines to execute. When the
bsub command reads a script from its standard
input, it can be modified right after
bsub returns for the next job submission.
When the script is specified on the
bsub command line, the script is not spooled:
%
bsub myscript
Job <1234> submitted to default queue <normal>.
In this case the command line myscript is spooled, instead of the contents of the
myscript file. Later modifications to the myscript file can affect job behavior.
Specifying embedded submission options
You can specify job submission options in scripts read from standard input by the bsub
command using lines starting with
#BSUB:
%
bsub -q simulation
bsub> #BSUB -q test
bsub> #BSUB -o outfile -R "mem>10"
bsub> myjob arg1 arg2
bsub> #BSUB -J simjob
bsub> ^D
Job <1234> submitted to queue <simulation>.
There are a few things to note:
Command-line options override embedded options. In this example, the job is
submitted to the
simulation queue rather than the test queue.
Submission options can be specified anywhere in the standard input. In the above
example, the
-J option of bsub is specified after the command to be run.
More than one option can be specified on one line, as shown in the example above.
Running a job under a particular shell
By default, LSF runs batch jobs using the Bourne (/bin/sh) shell. You can specify the
shell under which a job is to run. This is done by specifying an interpreter in the first line
of the script.
For example:
%
bsub
bsub> #!/bin/csh -f
bsub> set coredump=‘ls |grep core‘
bsub> if ( "$coredump" != "") then
bsub> mv core core.‘date | cut -d" " -f1‘
bsub> endif
bsub> myjob
bsub> ^D
Job <1234> is submitted to default queue <normal>.
The bsub command must read the job script from standard input to set the execution
shell. If you do not specify a shell in the script, the script is run using
/bin/sh. If the
first line of the script starts with a
# not immediately followed by an exclamation mark
(
!), then /bin/csh is used to run the job.