HP XC System Software Administration Guide Version 3.2

Important:
Do not pass a command that requires interaction as an argument to the pdsh command.
Prompting from the remote node can cause the command to hang.
The following example runs the uptime command on all the nodes in a four-node system.
# pdsh -a "uptime"
n4: 15:51:40 up 2 days, 2:41, 4 users, load average: 0.48, 0.29, 0.11
n3: 15:49:17 up 1 day, 4:55, 0 users, load average: 0.00, 0.00, 0.00
n2: 15:50:32 up 1 day, 4:55, 0 users, load average: 0.00, 0.00, 0.00
n1: 15:47:21 up 1 day, 4:27, 0 users, load average: 0.00, 0.00, 0.00
The -w option to pdsh command enables you to specify certain nodes. The following example
uses this option and a nodelist to specify only nodes n1, n2, and n3.
# pdsh -w n[1-3] "uptime"
n3: 15:53:09 up 1 day, 4:55, 0 users, load average: 0.00, 0.00, 0.00
n2: 15:54:37 up 1 day, 4:55, 0 users, load average: 0.00, 0.00, 0.00
n1: 15:58:11 up 1 day, 4:27, 0 users, load average: 0.00, 0.00, 0.00
For additional information, see pdsh(1). You can also find additional information at the following
web address:
http://www.llnl.gov/linux/pdsh/
1.3.3.2 Using the cexec Command
The cexec command provides the same facility as the pdsh command plus two additional
features:
The cexec command provides an additional option, which enables you to specify a host
group or a service group:
A host group is a designated list of nodes.
A service group is a list of nodes and the services that are configured to run on them.
The output of the cexec command is logged as an event, but the output of the pdsh
command is not.
The format of this command is:
cexec -[options] " command ... "
Important:
Do not pass a command that requires interaction as an argument to the cexec command.
Prompting from the remote node can cause the command to hang.
Useful command options include the following:
Targets all nodes.
-a
Runs the remote commands as the specified user.
-lusername
Sets a list of target nodes.
-wnodename,...
Sets a list of target nodes to be excluded.
-xnodename,...
The following example runs the users command on all the nodes in a four-node system:
# cexec -a "users"
n4: root db dal guest
n3: cjg
n2: rc wk
n1: root tcr
The following example runs the who --count command on nodes n12 and n25:
1.3 HP XC Command Environment 37