cexec(1)cexec(1)NAMEcexec - Issues comands to the specified hosts in parallel. In a Ser‐
viceguard cluster, defaults to issuing commands cluster-wide. When not
in a Serviceguard cluster, defaults to issuing commands on the local
host. Command execution reports can be created, and saved reports can
be used to replay commands. cexec is part of the Distributed Systems
Administration Utilities (DSAU).
SYNOPSIS
Path: /opt/dsau/bin/cexec
[options] command
{-h|--help | -?}
--retry={all|fail|success} report_file
{-V|--version}
DESCRIPTION
runs commands on multiple systems in parallel on either distributed
systems or in a Serviceguard cluster. Runs the command cluster-wide by
default in a Serviceguard cluster, subject to user authorization. also
enables users to view reports of previously run commands, and to retry
commands that did not execute either because a node was unreachable or
because the command returned an error status on the remote system.
In a Serviceguard cluster, the user must have the MONITOR role or have
root privileges in order for to get the list of cluster members. For
non-root users without the MONITOR role, DSAU maintains a cluster-mem‐
bership list based on member addition and deletion events during the
life of the cluster. and related tools (, , ) use this list. The list
is maintained at: /var/opt/dsau/sg/nodelist.
Remote Command Transport Options
The user selects how runs commands on remote hosts at runtime using the
-R option. The protocols listed below are supported, the default is
ssh.
· rsh
Uses an internal, thread-safe implementation of BSD to run
commands using the standard rsh(1) protocol.
· ssh
Uses a variant of to run multiple copies of the command. is
the default command transport.
Standard cexec
Options
-a reads the /etc/machines file to obtain the list of nodes.
This option has no arguments. Note that /etc/machines is not
shipped by default and can be created on a per-host basis.
The format for the /etc/machines file is the same as that for
the --hostsfile described below.
-f | --hostsfile filename
Runs the command on all hosts listed in the specified file.
The file must contain a list of target hosts, one hostname
per line. Hostlist expressions are valid; see HOSTLIST
EXPRESSIONS below.
-n | -w | --nodes host1[,host2,...]
Target the specified list of hosts. In a Serviceguard clus‐
ter, the target host list is not required and the default is
all cluster members. The host list may contain hostlist
expressions of the form "host[1-5,7]" For more information
about the hostlist format, see the HOSTLIST EXPRESSIONS sec‐
tion below. This option overrides all other host specifica‐
tion options.
-x | --exclude host1[,host2,...]
Exclude the specified hosts.
Other
Options
-fanout number
Sets the maximum number of simultaneous remote commands to
number. The default is 32.
-h | --help | -?
Displays commands and use information from and quits.
-l | --user user
Runs remote commands as another user, subject to authoriza‐
tion. When using remsh, the user issuing the command must be
authorized in the remote user's /.rhosts. When using ssh,
the local cexec user must have performed a key exchange with
the specified remote ssh user..
-R | --rcmd {ssh | rsh}
Set remote command transport option to the transport, either
or .
-r | --retry={all | fail | success} reportfile
retries commands on the nodes on which they were targeted to
run in the reportfile specified. re-runs the command only on
the failed nodes, re-runs the commands on all nodes, re-runs
the command on nodes where it successfully ran earlier.
Report files can be renamed. When renamed, they do not need
the .rpt file extension, but they must be in the
$HOME/.cexec/reports directory.
-report_loc
Displays the location of the reports that generates. When
this option is used, it displays the command and the reports
it generated. All reports are located in the
$HOME/.cexec/reports directory. The user cannot change the
location of the reports.
-t | --timeout seconds
Sets the connect timeout in seconds.
-u | --ctime seconds
Sets a limit on the amount of time a remote command is
allowed to execute. Default is no limit.
-V | --version
Shows the version of .
ENVIRONMENT VARIABLES
When not running on a Serviceguard cluster, if no other node selection
option is used, the CFANOUT_HOSTS environment variable may be set to a
filename from which a list of target hosts is read. The file should
contain a list of hosts, one per line.
NETWORKING FEATURES
is based on the command. supports remsh or the rsh protocol as a com‐
mand transport. remsh and its related utilities like have well docu‐
mented security shortcomings. For unprivileged users to use the trans‐
port of and , the /opt/dsau/bin/pdsh program must be owned by root and
the SUID bit must be set, just like the /usr/bin/remsh program. As
shipped, the binary is owned by user bin and the SUID bit is not set.
Thus an unprivileged user cannot use the "" option until the system
administrator explicitly enables it. The system administrator should
only enable usage of in environments where users and hosts are trusted.
The default ssh transport offers significantly better security. The
tool makes as easy to configure as the .rhosts file of .
LIMITATIONS
assumes a predefined security setup when using remsh and ssh trans‐
ports. Neither transport can prompt for a password. For remsh, the
user's /.rhosts must be appropriately configured. For ssh, a public
key distribution must be performed to all targeted hosts. For the ssh
case, the csshsetup tool is provided to make the ssh setup as simple as
possible. For example, csshsetup makes it easy to set up any node to
any node trust relationships in a Serviceguard cluster for groups of
managed systems.
For the ssh transport, the connect timeout is not adjustable.
Hostlist parsing assumes numerical part of hostname is at the end only,
for example, specifying remote[0-5]host will not work.
You cannot use interactive commands (commands that prompt for input or
expect a tty to be present).
The number of nodes on which can simultaneously execute remote jobs is
limited by the maximum number of threads that can be created concur‐
rently and the availability of reserved ports in modules.
Note: The family of commands (, , , , ) are based on . While
reports the worst-of exit status of remotely executed com‐
mands so the user can determine if the command succeeded, the
-S feature does not work for c shell (csh(1)) users. Thus
all commands in the family, which invoke pdsh with the -S
switch, do not report status of remotely executed commands.
When using the remote shell transport, rsh, the underlying command
stops processing the list of hosts after encountering an unknown host.
If used with the --report_loc option, therefore, the report file will
not accurately reflect the complete hostlist specified on the original
command line. The ssh transport does not have this restriction.
HOSTLIST EXPRESSIONS
accepts lists of hosts in the general form: prefix[n-m,l-k,...], where
n < m and l < k, and so on, as an alternative to explicit lists of
hosts. This form is not the same as regular expression character
classes (also denoted by "[]" ). For example, node[19] does not repre‐
sent an expression matching node1 or node9, but rather the degenerate
hostlist: node19.
The hostlist syntax is provided only as a convenience on clusters using
a "prefixNNN" naming convention and specification of ranges should not
be considered necessary -- thus node1,node9 could be listed specifi‐
cally or as hostlist node[1,9].
EXAMPLES
Determine disk space usage cluster-wide in a Serviceguard cluster:
cexec bdf
Check memory utilization cluster-wide in Serviceguard cluster:
cexec vmstat -n | dshback -c
Bounce a daemon across a set of systems:
cexec-w node07,node09,node010 "/sbin/init.d/daemon stop; \
/sbin/init.d/daemon start"
Set a configuration variable across a set of systems:
cexec-w node7,node9 \
/usr/sbin/ch_rc -a -p CONFIGURED=1 /etc/rc.config.d/conf_file
Run command on node01,node02,...,node05 using ssh (default).
cexec-w node[01-05] command
Run command on node7, node9, node10 using rsh
cexec-w node[7,9-10] R rsh command
Run command on node0 , node4 , node5 using ssh
cexec-w node[0-5] -x node[1-3] command
Re-run saved command on all failed nodes from saved.rpt
cexec -retry=fail saved.rpt
Note that some shells interpret brackets ([ and ]) for pattern match‐
ing. Depending on your shell, you may need to enclose ranged lists
within quotes. For example, in tcsh, the first example above should be
executed as:
cexec-w "node[01-05]" command
SEE ALSOpdsh(1), rsh(1), ssh(1), dshbak(1), pdcp(1), ccp(1), ckill(1), cps(1),
cuptime(1), cwall(1M), csshsetup(1)cexec(1)