If you want to run the CLI and pass in a simple command, append the command in quotes after the SSH login credentials, for example:
# ssh admin@hostname
-p 10000 "list Server"
You can submit multiple commands using a semicolon (;) as the command delimiter, for example:
# ssh admin@hostname
-p 10000 "list Server; show Server name=MyServer"
If you have enabled key-based authentication, you are not prompted
for the password to access the CLI, and the results are displayed.
If you have not, you must enter the CLI password before the
results are returned. See Section 1.3, “Key-Based Authentication” for
information on setting up key-based authentication. Alternatively,
you can use the sample eovmcli
or
eovmclixml
Expect scripts on the Oracle VM Manager
host to pass in the password without being prompted. These scripts
return the results in either plain text, or XML. For example, to
display a list of the Oracle VM Servers in plain text using the
eovmcli
Expect script, enter:
#cd /u01/app/oracle/ovm-manager-3/ovm_cli/expectscripts/
#./eovmcli admin
Command: list Server Status: Success Time:password
"list Server"date
Data: id:00:e0:81:4d:41:01:00:e0:81:4d:40:d6:00:e0:81:4d name:MyServer1 id:00:e0:81:4d:40:c6:00:e0:81:4d:40:c7:ff:ff:ff:ff name:MyServer2 id:00:e0:81:4d:40:f5:00:e0:81:4d:40:be:00:e0:81:4d name:MyServer3
To display the output in XML, use the
eovmclixml
Expect script, for example:
#cd /u01/app/oracle/ovm-manager-3/ovm_cli/expectscripts/
#./eovmclixml admin
<response> <command> list Server </command> <status> Success </status> <time>password
"list Server"date
</time> <data> <object value="id:00:e0:81:4d:41:01:00:e0:81:4d:40:d6:00:e0:81:4d name:MyServer1"/> <object value="id:00:e0:81:4d:40:c6:00:e0:81:4d:40:c7:ff:ff:ff:ff name:MyServer2"/> <object value="id:00:e0:81:4d:40:f5:00:e0:81:4d:40:be:00:e0:81:4d name:MyServer3"/> </data>
You can only use the semicolon to separate commands when using the
ssh command. The eovmcli
or
eovmclixml
Expect scripts do not accept the
semicolon as a command delimiter.
If you want to pass in more complex commands to the CLI, you can write your own Expect scripts, as discussed in Section 1.6.2, “Writing Expect Scripts”. You can also use any other programming language to write scripts using the CLI as discussed in Section 1.8, “Integrating the CLI into Your Applications”.