Connect string and jboss-cli.xml
To use the CLI tool, a connection must be specified. Before you start any configuration the default connection (set in jboss-cli.xml) is:
-
"controller=remote+http://controller=localhost:9990"
The ImageMaster configuration script changes this default to the following:
-
The connection type is changed from HTTP to HTTPS.
-
The default port (portManagementHttps) is 10048, which you can adjust.
"controller=remote+https://controller=localhost:10048"
If you have any trouble with the connection when using the CLI tool, check the instructions in: Update the default connector settings of the jboss-cli tool for HTTPS.
In a complex environment where you need to handle multiple application servers, you can organize this based on connect string environment variables as illustrated below with ${CONNECT_STRING}.
For Linux
Execution of single command:
${JBOSS_HOME}/bin/jboss-cli.sh --echo-command --connect ${CONNECT_STRING} --command="singleCommand"
Execution of script without a property file:
${JBOSS_HOME}/bin/jboss-cli.sh --echo-command --connect ${CONNECT_STRING} --file=path/to/cli-script
Execution of script with a property file:
${JBOSS_HOME}/bin/jboss-cli.sh --echo-command --connect ${CONNECT_STRING} --file=path/to/cli-script --properties=path/to/property-file
For Windows
Execution of single command:
%JBOSS_HOME%\bin\jboss-cli.bat --echo-command --connect %CONNECT_STRING% --command="singleCommand"
Execution of script without a property file:
%JBOSS_HOME%\bin\jboss-cli.bat --echo-command --connect %CONNECT_STRING% --file=path\to\cli-script
Execution of script with a property file:
%JBOSS_HOME%\bin\jboss-cli.bat --echo-command --connect %CONNECT_STRING% --file=path\to\cli-script --properties=path\to\property-file
Displaying an executed command
The following option is used in the above examples just to see the executed command, which is useful if you put multiple commands in one CLI script:
--echo-command
Do not use this feature if the output contains passwords.