Runs a task on a group of hosts.


lsgrun [-i] [-p] [-P] [-S] [-v] -R "res_req" [command [argument ...]]
lsgrun [-i] [-p] [-P] [-S] [-v] -f host_file [command [argument ...]]
lsgrun [-i] [-p] [-P] [-S] [-v] -m host_name ... [command [argument ...]]
lsgrun [-h | -V]
lsgrun [-i] [-p] [-P] [-S] [-v] [-R "res_req"] -n num_hosts [command [argument ...]]


Use the lsgrun command for fast global operations such as starting daemons, replicating files to or from local disks, looking for processes that are running on all hosts, checking who is logged in on each host. The hosts can be specified by using a host file, a list of host names or by letting the system select the hosts. If the LSB_DISABLE_LIMLOCK_EXCL=y parameter is set to enable preemption of exclusive jobs, for example, you can use the lsgrun command to start a task on hosts that are running exclusive jobs.

The lsgrun command has the following default behavior:
  • The lsgrun command is not interactive.
  • The specified task runs sequentially on hosts with full pseudoterminal (tty) support.
  • The lsgrun command does not create a pseudo-terminal.
  • LSF uses as many processors as available to run the specified task.
  • The resource requirement for host selection is r15s:pg.
  • The prompt Command> is displayed to allow users to type in a command as the task. The command prompt is terminated by a CTRL-D or EOF. The command then runs on the specified hosts.

The -f host_file, -m host_name, or -n num_processors options are required. These options are mutually exclusive.

If the LSF_UGROUP_TRANSFER parameter is enabled in the lsf.conf file, tasks in the execution side that the lsgrun command runs use the UNIX group information that is set by the user on the client side.


Interactive operation mode. You are asked whether the task is to run on all hosts. If you answer y, the task is started on all specified hosts; otherwise, you are asked to specify hosts interactively.
Creates a pseudo-terminal on UNIX and Linux hosts to run programs that require a pseudo-terminal, for example, the vi command.

The -P option is not supported on Windows.

Parallel run mode. Runs the task on all hosts simultaneously and without pseudoterminal tty support.

If the -p option is specified with the -P option, the -P option is ignored.

Use this option for fast start-up of tasks. However, any output from remote tasks arrives at the terminal in arbitrary order, depending on task execution speeds on individual hosts.

Creates a pseudo-terminal with shell mode support on UNIX hosts.

Shell mode support is required for running interactive shells or applications that redefine the CTRL-C and CTRL-Z keys, such as jove.

The -S option is not supported on Windows.

Verbose mode. Displays the name of the host or hosts running the task.
-f host_file
Runs the task on all hosts that are listed in the file that is specified by the host_file argument.

Specify a file that contains a list of host names. Host names must be separated by white space characters (for example, SPACE, TAB, and NEWLINE).

This option is exclusive of options -n, -R, and -m.

-m host_name ...

Either -f host_file, -m host_name or -n num_processors is required.

Runs the task on all specified hosts.

Specify hosts on which to run the task. If multiple host names are specified, the host names must be enclosed by quotation marks (" or ') and separated by white space.

This option is exclusive of options -n, -R, and -f.

-n num_hosts
Runs the task in a cluster with the required number of available hosts.

One host can be used to start several tasks if the host is multiprocessor. This option can be used together with option -R to select hosts.

This option is exclusive of options -m and -f.

-R "res_req"
Runs the task on hosts with the required resource requirements.

Specify the resource requirement expression for host selection. Unless a type == value expression is in res_req to specify otherwise, the resource requirement is used to choose from all hosts with the same host type as the local host.

The -R option can be used together with option -n to choose a specified number of processors to run the task.

Exclusive resources need to be explicitly specified within the resource requirement string. For example, a resource that is called bigmem is defined in the lsf.shared file and defined it as an exclusive resource for hostE in lsf.cluster.mycluster. Use the following command to submit a task to run on hostE:
lsgrun -R "bigmem" myjob
lsgrun -R "defined(bigmem)" myjob

If the -m option is specified with a single host name, the -R option is ignored.

command [argument ...]
Specify the command to run. The command must be the last argument on the command line.
Prints command usage to stderr and exits.
Prints LSF release version to stderr and exits.


Exit status is 0 if all tasks run correctly.

If tasks do not run correct, the exit status is the first nonzero status that is returned by a remote task. The lsgrun command runs the task on all hosts even if some have nonzero exit status.

Exit status is -10 if a problem is detected in LSF.

See also

lsrun, lsplace