The JBoss ON CLI is a shell and interpreter so that commands and statements can be executed interactively against the JBoss ON server. Scripts stored in files can also be executed, so it is possible to automate operations for the JBoss ON server.
The CLI script is run directly from its cli-install-dir
/bin directory. There are two files associated with launching the JBoss ON CLI:
A script (
A file of environment variables (
The environment variables in the
rhq-cli-env.sh|bat file use defaults that are reasonable for most deployments, so this file usually does not need to be edited. It is possible to reset variables to point a server that doesn't follow the default installation, such as a virtual machine or a non-default JVM. The comments at the top of the
rhq-cli-env.|bat file contain a detailed list of available environment variables.
Do not edit the
rhq-cli.sh|bat file. Only set environment variables through the terminal or in the
rhq-cli-env.sh|bat file, not the script itself.
Be sure to set the correct path to the Java 6 installation in the
RHQ_CLI_JAVA_HOME or the
rhq-cli.sh|bat script has the following general syntax:
It is possible to launch the CLI script without any arguments, including specifying a username. This opens the CLI client without connecting to the server.
[jsmith@server bin]$ cliRoot/rhq-remoting-cli-4.9.0.JON320GA/bin/rhq-cli.sh
RHQ - RHQ Enterprise Remote CLI
While scripts can be executed without logging in, most of the functionality of the CLI is unavailable. To truly use the JBoss ON CLI, log into the server as a JBoss ON user, either by passing a username and password or by using the login command after starting the CLI.
[jsmith@server bin]$ rhq-cli -u rhqadmin -p rhqadmin
The CLI provides two modes of operation: interactive and non-interactive.
Interactive mode executes an individual statement. Interactive mode provides a simple environment for prototyping, testing, learning, and discovering features of the CLI.
Non-interactive mode loads a specified script file and executes multiple commands in sequence. Non-interactive mode provides the capability to automate tasks such as collecting metrics on managed resources or executing a scheduled operation.
These native commands, like quit, are available only in interactive mode. They cannot be used in a script when the CLI is used in non-interactive mode, such as when running a script from file. In these instances, use the Java method.
Whatever user you run the CLI as — meaning, whatever system user runs the
rhq-cli.sh script — must have write access to the
logs/ directory for the CLI.
If the CLI is installed as root, for example, then a regular user cannot run the CLI; it fails with write errors.