Execute a Command or Script on Grid Hosts (hostExec)
The hostExec
command runs a command (such as a system command or TimesTen command) or a script on hosts in the grid, as specified.
ttGridAdmin hostExec [-only hostname] [-exclude hostname] [-parallel n] command | -script filepath
Options
The hostExec
command has the options:
Option | Description |
---|---|
|
The command or script is run only on the specified hosts. Specify just one host with Use host names as defined in the model. Without |
|
The command or script is performed on all hosts in the grid except for the specified hosts. Specify just one host with Use host names as defined in the model. Without |
|
Specifies that the command or script runs on no more than |
|
Or:
|
Examples
This example first shows the existing hosts in the grid, then uses hostExec
to run the df /
command (to show disk space) on each host, excluding mysys3host
and mysys4host
. So the command is performed on mysys1host
and mysys2host
.
% ttGridAdmin hostList Name IntAddress ExtAddress DSG Comment ----------- ---------------------- ---------------------- --- ------- mysys1host intmysys1.example.com extmysys1.example.com 1 mysys2host intmysys2.example.com extmysys2.example.com 2 mysys3host intmysys3.example.com extmysys3.example.com 1 mysys4host intmysys4.example.com extmysys4.example.com 2 % ttGridAdmin hostExec -exclude mysys3host -exclude mysys4host df / Commands executed on: mysys1host rc 0 mysys2host rc 0 Return code from mysys1host: 0 Output from mysys1host: Filesystem 1K-blocks Used Available Use% Mounted on /dev/xvda2 173483816 28416336 136254988 18% / Return code from mysys2host: 0 Output from mysys2host: Filesystem 1K-blocks Used Available Use% Mounted on /dev/xvda2 117144964 35319512 75874836 32% /
Notes
-
The command or script is run on each host as the instance administrator through passwordless SSH.
-
No environment variables are set on the hosts, other than those set by SSH by default.
-
The command returns 2000 if execution did not complete prior to the timeout.
-
During execution,
stdout
andstderr
output is displayed as part of thestdout
andstderr
output from thehostExec
command. Because output is buffered, the output from different commands is not intermingled.