Red Hat Training

A Red Hat training course is available for Red Hat JBoss Operations Network

5.3. Interactive CLI Commands

Some native commands are included in the org.rhq.enterprise.client.commands inside the CLI JAR itself. These commands are part of the CLI itself. Other input in the JBoss ON CLI is passed through the JavaScript interpreter to the server; these commands are passed to the CLI module.
IMPORTANT
These native commands 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, you must use the Java method.

5.3.1. login

Logs into a JBoss ON server with the specified username and password.
Optionally, the hostname (or IP address) and port can be specified. The hostname defaults to localhost, and the port defaults to 7080.
It is also possible to specify a transport protocol, which sets whether to use SSL to communicate with the server. If the transport is not given, then the CLI evaluates the transport based on the port. A port ending in 443 automatically uses SSL, while all other ports use standard connections. The only reason to explicitly set a transport method is if the server is listening over SSL over a port which does not end in 443.
login username password [host] [port]
The login command can be used in a module script or with the rhq-cli.sh --f option.

5.3.2. logout

Logs off of the JBoss ON server without existing from the CLI.
logout
The logout command can be used in a module script or with the rhq-cli.sh --f option.

5.3.3. quit

Exits the CLI.
quit
This only works when the CLI is running interactively. In a script, use java.lang.System.exit.

5.3.4. record

Records user input commands to a file. This is very useful if you are running the CLI interactively to test a new script that will later be run non-interactively in the CLI or as an alert server-side script.
record [-b | -e] [-a] -f filename
Option Description
-b, --start
Specify this option to start recording.
-e, --end
Specify this option to stop recording.
-a, --append
Appends output to the end of a file. If not specified, output will be written starting at the beginning of the file.
-f, --file
The file where output will be written.

5.3.5. exec (deprecated)

NOTE
While an external script can be loaded into the CLI session using the exec command, this method of loading custom scripts and functions is deprecated. It is recommended that developers use a CommonJS module script. The default location for module scripts is cliRoot/rhq-remoting-cli-4.9.0.JON320GA/samples/modules.
Executes a statement or a script with the specified file name. A statement wraps onto multiple lines using backslashes.
Option Description
-f, --file
The full path filename of the script to execute. The full path must be given, or the CLI cannot locate the script.
-s, --style=named|indexed
Indicates the style or format of arguments passed to the script. It must have a value of either indexed or named.