Platform LSF Administration Guide Version 6.2
Chapter 35
Interactive Jobs with bsub
Administering Platform LSF
525
Writing Job Scripts
You can build a job file one line at a time, or create it from another file, by running bsub
without specifying a job to submit. When you do this, you start an interactive session in
which
bsub reads command lines from the standard input and submits them as a single
batch job. You are prompted with
bsub> for each line.
You can use the
bsub -Zs command to spool a file.
For more details on
bsub options, see the bsub(1) man page.
Writing a job file one line at a time
UNIX example
%
bsub -q simulation
bsub> cd /work/data/myhomedir
bsub> myjob arg1 arg2 ......
bsub> rm myjob.log
bsub> ^D
Job <1234> submitted to queue <simulation>.
In the above example, the 3 command lines run as a Bourne shell (/bin/sh) script.
Only valid Bourne shell command lines are acceptable in this case.
Windows example
C:\> bsub -q simulation
bsub> cd \\server\data\myhomedir
bsub> myjob arg1 arg2 ......
bsub> del myjob.log
bsub> ^Z
Job <1234> submitted to queue <simulation>.
In the above example, the 3 command lines run as a batch file (.BAT). Note that only
valid Windows batch file command lines are acceptable in this case.
Specifying job options in a file
In this example, options to run the job are specified in the options_file.
%
bsub -q simulation < options_file
Job <1234> submitted to queue <simulation>.
UNIX
On UNIX, the options_file must be a text file that contains Bourne shell
command lines. It cannot be a binary executable file.
Windows
On Windows, the options_file must be a text file containing Windows batch file
command lines.
Spooling a job command file
Use bsub -Zs to spool a job command file to the directory specified by the
JOB_SPOOL_DIR parameter in
lsb.params, and use the spooled file as the
command file for the job.
Use the
bmod -Zsn command to modify or remove the command file after the job has
been submitted. Removing or modifying the original input file does not affect the
submitted job.
Redirecting a script to bsub standard input
You can redirect a script to the standard input of the bsub command: