NAME

xdsh - Concurrently runs commands on multiple nodes.


SYNOPSIS

xdsh noderange [-B bypass] [-C context] [-e] [-E environment_file] [-f fanout] [-i] [-K] [-L] [-l userID] [-m] [-o node_options] [-Q] [-r node_remote_shell] [-s] [-S csh|ksh] [-t timeout] [-T] [-v] [-X env_list] [-z] command_list

xdsh [-h | -V | -q]


DESCRIPTION

The xdsh command runs commands in parallel on remote nodes. The xdsh command issues a remote shell command for each target specified, and returns the output from all targets, formatted so that command results from all nodes can be managed. The xdsh command is an xCAT Distributed Shell Utility.

TARGET CONTEXT:

The xdsh command target context is the database where the target or target group is defined. A default context can be configured using the -C context flag or the DSH_CONTEXT environment variable. If neither are specified, the default context is XCAT.

A context is enabled for use with a DSH Utilities command by installing a context extension file in the /opt/xcat/xdsh/Context directory. The target or target group context can be explicitly specified by qualify- ing a target name with a context name, or implicitly defined by speci- fying a default context for unqualified target names (See Target lists).

TARGET SPECIFICATION:

A target is a node where a remote command will be executed. Node targets are specified inputting the node_list or nodegroups.

If the local host is included as part of the targets, the command_list is executed directly on the local host and not through the configured remote shell, unless a user_ID is specified for execution with the local host (see Remote user).

Node targets can also be specified using node ranges as supported by xCAT. If the same target is specified more than once, the remote com- mand will only be executed once on the specified target.

COMMAND SPECIFICATION:

The commands to execute on the remote targets are specified by the command_list xdsh parameter, or executing a local script using the -e flag.

The syntax for the command_list xdsh parameter is as follows:

command[; command]...

where command is the command to run on the remote target. Quotation marks are required to ensure that all commands in the list are executed remotely, and that any special characters are interpreted correctly on the remote target. A script file on the local host can be executed on each of the remote targets by using the -e flag. If -e is specified, command_list is the script name and arguments to the script. For example:

xdsh hostname -e script_filename [arguments]...

The script_filename file is copied to a random filename in the /tmp directory on each remote target and then executed on the targets.

The xdsh command does not work with any interactive commands, including those that read from standard input.

REMOTE SHELL COMMAND:

The xdsh command uses a configurable remote shell command to execute remote commands on the remote targets. Support is explicitly provided for AIX Remote Shell and OpenSSH, but any secure remote command that conforms to the IETF (Internet Engineering Task Force) Secure Remote Command Protocol can be used.

The remote shell is determined as follows, in order of precedence:

1. The -r flag.

2. The DSH_NODE_RSH environment variable.

3. The default node remote shell as defined by the target context.

4. The /usr/bin/ssh command.

The remote shell options are determined as follows, in order of prece- dence:

1. The -o flag.

2. The DSH_NODE_OPTS environment variable.

REMOTE SHELL ENVIRONMENT:

The shell environment used on the remote target defaults to the shell defined for the user_ID on the remote target. The command syntax that xdsh uses to form the remote commands can be specified using the -S flag. If -S is not specified, the syntax defaults to sh syntax.

When commands are executed on the remote target, the path used is determined by the DSH_PATH environment variable defined in the shell of the current user. If DSH_PATH is not set, the path used is the remote shell default path. For example, to set the local path for the remote targets, use:

DSH_PATH=$PATH

The -E flag exports a local environment definition file to each remote target. Environment variables specified in this file are defined in the remote shell environment before the command_list is executed.

COMMAND EXECUTION:

The maximum number of concurrent remote shell command processes (the fanout) can be specified with the -f flag or with the DSH_FANOUT environment variable. The fanout is only restricted by the number of remote shell commands that can be run in parallel. You can experiment with the DSH_FANOUT value on your management server to see if higher values are appropriate.

A timeout value for remote command execution can be specified with the -t flag or with the DSH_TIMEOUT environment variable. If any remote target does not provide output to either standard output or standard error within the timeout value, xdsh displays an error message and exits.

If streaming mode is specified with the -s flag, output is returned as it becomes available from each target, instead of waiting for the command_list to complete on all targets before returning output. This can improve performance but causes the output to be unsorted.

The -z flag displays the exit code from the last command issued on the remote node in command_list. Note that OpenSSH behaves differently; it returns the exit status of the last remote command issued as its exit status. This affects the behavior of xdsh and may require using the -c flag. If the command issued on the remote node is run in the background, the exit status is not displayed.

The -m flag monitors execution of the xdsh command by printing status messages to standard output. Each status message is preceded by dsh.

The -T flag provides diagnostic trace information for the execution of the xdsh command. Default settings and the actual remote shell commands executed on the remote targets are displayed.

No error detection or recovery mechanism is provided for remote targets. The xdsh command output to standard error and standard output can be analyzed to determine the appropriate course of action. In interac- tive mode, if a command cannot be executed on a remote target (for example, a remote shell command resulting in a non-zero return code), subsequent commands are not sent to this node on this invocation of the xdsh command unless the -c flag is specified.

COMMAND OUTPUT:

The xdsh command waits until complete output is available from each remote shell process and then displays that output before initiating new remote shell processes. This default behavior is overridden by the -s flag.

The xdsh command output consists of standard error and standard output from the remote commands. The xdsh standard output is the standard output from the remote shell command. The xdsh standard error is the standard error from the remote shell command. Each line is prefixed with the host name of the node that produced the output. The host name is followed by the : character and a command output line. A filter for displaying identical outputs grouped by node is provided separately. See the xdshbak command for more information.

A command can be run silently using the -Q flag; no output from each target's standard output or standard error is displayed.

SIGNALS:

Signal 2 (INT), Signal 3 (QUIT), and Signal 15 (TERM) are propagated to the commands executing on the remote targets.

Signal 19 (CONT), Signal 17 (STOP), and Signal 18 (TSTP) default to xdsh; the xdsh command responds normally to these signals, but the signals do not have an effect on remotely executing commands. Other signals are caught by xdsh and have their default effects on the xdsh command; all current child processes, through propagation to remotely running commands, are terminated (SIGTERM).


OPTIONS

-C|--context context

The default context to use when resolving target names. The context value must correspond to a valid context extension module in the /opt/xcat/xdsh/Context directory. For example, the /opt/xcat/xdsh/Context/DSH.pm file is the module for the DSH context.

-e|--execute

Indicates that command_list specifies a local script filename and arguments to be executed on the remote targets. The script file is copied to the remote targets and then remotely executed with the given arguments. The DSH_NODE_RCP environment variables specify the remote copy command to use to copy the script file to node targets.

-E|--environment environment_file

Specifies that the environment_file contains environment variable definitions to export to the target before executing the command_list. The DSH_NODE_RCP and environment variables specify the remote copy command to use to export the file to node targets.

-f|--fanout fanout_value

Specifies a fanout value for the maximum number of concur- rently executing remote shell processes. Serial execution can be specified by indicating a fanout value of 1. If -f is not specified, a default fanout value of 64 is used.

-h|--help

Displays usage information.

-K|--ssh-setup

Set up the SSH keys for the specified node list. Currently, this must be run on the management node (not on a remote client), because it forces itself into bypass mode.

-l|--user user_ID

Specifies a remote user name to use for remote command exe- cution.

-L|--no-locale

Specifies to not export the locale definitions of the local host to the remote targets. Local host locale definitions are exported by default to each remote target.

-m|--monitor

Monitors remote shell execution by displaying status messages during execution on each target.

-o|--node-options node_options

Specifies options to pass to the remote shell command for node targets. The options must be specified within double quotation marks (``'') to distinguish them from xdsh options. The syntax for node_options

-q|--show-config

Displays the current environment settings for all DSH Utilities commands. This includes the values of all environment variables and settings for all currently installed and valid contexts. Each setting is prefixed with context: to identify the source context of the setting.

-Q|--silent

Specifies silent mode. No target output is written to stan- dard output or standard error. Monitoring messages are written to standard output.

-r|--node-rsh node_remote_shell Specifies the full path of the remote shell command used for remote command execution on node targets.
-s|--stream

Specifies that output is returned as it becomes available from each target, instead of waiting for the command_list to be completed on a target before returning output.

-S|--syntax csh|ksh

Specifies the shell syntax to be used on the remote target. If not specified, the ksh syntax is used.

-t|--timeout timeout

Specifies the time, in seconds, to wait for output from any currently executing remote targets. If no output is available from any target in the specified timeout, xdsh displays an error and terminates execution for the remote targets that failed to respond. If timeout is not specified, xdsh waits indefinitely to continue processing output from all remote targets. When specified with the -i flag, the user is prompted for an additional timeout interval to wait for output.

-T|--trace

Enables trace mode. The xdsh command prints diagnostic messages to standard output during execution to each target.

-v|--verify

Verifies each target before executing any remote commands on the target. If a target is not responding, execution of remote commands for the target is canceled. When specified with the -i flag, the user is prompted to retry the verification request.

-V|--version

Displays the xdsh command version information.

-X env_list

Ignore xdsh environment variables. This option can take an argument which is a comma separated list of environment variable names that should NOT be ignored. If there is no argument to this option, or the argument is an empty string, all xdsh environment variables will be ignored. This option is useful when running xdsh from within other scripts when you don't want the user's environment affecting the behavior of xdsh.

-z|--exit-status

Displays the exit status for the last remotely executed non-asynchronous command on each target. If the command issued on the remote node is run in the background, the exit status is not displayed.

Exit values for each remote shell execution are displayed in messages from the xdsh command, if the remote shell exit values are non-zero. A non-zero return code from a remote shell indicates that an error was encountered in the remote shell. This return code is unrelated to the exit code of the remotely issued command. If a remote shell encounters an error, execution of the remote command on that target is bypassed.

The xdsh command exit code is 0 if the command executed without errors and all remote shell commands finished with exit codes of 0. If internal xdsh errors occur or the remote shell commands do not complete successfully, the xdsh command exit value is greater than 0. The exit value is increased by 1 for each successive instance of an unsuccessful remote command execution. If the remotely issued command is run in the background, the exit code of the remotely issued command is 0.


Environment Variables

DSH_CONTEXT

Specifies the default context to use when resolving targets. This variable is overridden by the -C flag.

DSH_ENVIRONMENT

Specifies a file that contains environment variable definitions to export to the target before executing the remote command. This variable is overridden by the -E flag.

DSH_FANOUT

Specifies the fanout value. This variable is overridden by the -f flag.

DSH_NODE_OPTS

Specifies the options to use for the remote shell command with node targets only. This variable is overridden by the -o flag.

DSH_NODE_RCP

Specifies the full path of the remote copy command to use to copy local scripts and local environment configuration files to node targets.

DSH_NODE_RSH

Specifies the full path of the remote shell to use for remote command execution on node targets. This variable is overridden by the -r flag.

DSH_NODEGROUP_PATH

Specifies a colon-separated list of directories that contain node group files for the DSH context. When the -a flag is specified in the DSH context, a list of unique node names is collected from all node group files in the path.

DSH_PATH

Sets the command path to use on the targets. If DSH_PATH is not set, the default path defined in the profile of the remote user_ID is used.

DSH_SYNTAX

Specifies the shell syntax to use on remote targets; ksh or csh. If not specified, the ksh syntax is assumed. This variable is overridden by the -S flag.

DSH_TIMEOUT

Specifies the time, in seconds, to wait for output from each remote target. This variable is overridden by the -t flag.


Security

The xdsh command has no security configuration requirements. All remote command security requirements - configuration, authentication, and authorization - are imposed by the underlying remote command configured for xdsh. The command assumes that authentication and authorization is configured between the local host and the remote targets. Interactive password prompting is not supported; an error is displayed and execution is bypassed for a remote target if password prompting occurs, or if either authorization or authentication to the remote target fails. Security configurations as they pertain to the remote environment and remote shell command are userdefined.


Examples


Files

/opt/xcat/xdsh/Context/

Location of the contexts available to use with DSH Utilities.


SEE ALSO

xdshbak(1), noderange(3)