The hostlist command can be used to specify hostnames for parallel command execution by way of the dsh or sysctl command. The command writes hostnames to stdout based on various criteria:
Before the names are written, there is an optional check of whether the nodes are responding.
The output from hostlist can be written to a file, which can then be used as a working collective file for dsh. Both dsh and sysctl can read hostnames from stdin, so the output of hostlist can be piped directly to dsh or sysctl.
To issue a command to the node in the first slot in each of the first 4 frames:
hostlist -s 1-4:1 | dsh -w - command
To run the program on the nodes on all slots for frame 1 and on slots 1-3 for frame 3, and also on host otherone:
hostlist -n 1-16,33-35 -w otherone > /tmp/wcoll WCOLL=/tmp/wcoll dsh program
To determine all the nodes in the SP system on which one is authenticated, and to bypass the nodes that are not responding and "badnode", issue the command:
hostlist -av -e badnode | sysctl -c - -L whoami | dshbak -c
Note: The -L option on sysctl is necessary if the dshbak filter is used. It causes the output lines of sysctl to be formatted with the hostname preceding each line.
Output might look like this:
HOSTS============================================================== host1 host2 host3 host4 host5 host6 host8 =================================================================== joe.@A.B.C HOSTS============================================================== host7 =================================================================== unknown
If the -c option is not specified, output will not be collapsed:
HOST: host1 =========== joe.@A.B.C HOST: host2 =========== joe.@A.B.C
·
·
·