LSF Version 7.3 - Administering Platform LSF
Writing Job Scripts
600 Administering Platform LSF
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>.
Note that:
◆ 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.
For example:
% bsub
bsub> # This is a comment line. This tells the system to use /bin/csh
to
bsub> # interpret the script.
bsub>
bsub> setenv DAY ‘date | cut -d" " -f1‘
bsub> myjob
bsub> ^D
Job <1234> is submitted to default queue <normal>.