The software described in this documentation is either no longer supported or is in extended support.
Oracle recommends that you upgrade to a current supported release.

1.2 About the spacecmd Command

You can use the spacecmd command-line interface (CLI) to perform most of the actions that you perform by using the web interface.

You can run the spacecmd command either directly on the Spacewalk server or remotely. If you run the spacecmd command remotely, you must specify the server by its IP address or by a resolvable domain name.

The following example shows how you would specify the server by its host name:

$ spacecmd -s swksvr.mydom.com
Welcome to spacecmd, a command-line interface to Spacewalk.

Type: 'help' for a list of commands
      'help <cmd>' for command-specific help
      'quit' to quit

Spacewalk Username: swadmin
Spacewalk Password: password
INFO: Connected to https://swksvr.mydom.com/rpc/api as swadmin

where the values for the host name, Spacewalk user, and password are those that you specified when installing and configuring Spacewalk.

Note

You must authenticate yourself as a Spacewalk user with an assigned role with sufficient privileges for performing the requested actions.

As an alternative to entering the Spacewalk user name and password at the prompts, you can use the -u and -p options to specify these values. Be aware however, that specifying the password on the command line is insecure, as it is visible in command histories and the process list. A more secure method is to create a credentials file, such as ~/.spacecmd/config with mode 400 that contains information that defines the Spacewalk server, user name, and password, as shown in the following example:

[spacecmd]
server=swksvr.mydom.com
username=swadmin
password=password

Note the following additional information about using the spacecmd CLI:

To display more help about a command, type help command.

To exit the shell, type exit or quit.

spacecmd attempts [Tab] completion of partial commands or arguments.

You can run spacecmd as an interactive shell or non-interactively. This guide includes examples of using the interactive shell. If you want to run spacecmd non-interactively, specify the spacecmd shell command and its arguments after a -- delimiter, for example:

$ spacecmd -- softwarechannel_create -l oraclelinux7-x86_64-ksplice \
  -n "Oracle Linux 7 x86_64 Ksplice Channel" -p oraclelinux7-x86_64 -a x86_64
INFO: Connected to https://swksvr.mydom.com/rpc/api as swadmin
$ spacecmd -q -- softwarechannel_list
INFO: Connected to https://swksvr.mydom.com/rpc/api as swadmin
oraclelinux7-x86_64
oraclelinux7-x86_64-addons
oraclelinux7-x86_64-ksplice
oraclelinux7-x86_64-optional
oraclelinux7-x86_64-patch
oraclelinux7-x86_64-spacewalk24-client
oraclelinux7-x86_64-spacewalk24-server
oraclelinux7-x86_64-uek-r3
oraclelinux7-x86_64-uek-r4
$ spacecmd -q -y -- softwarechannel_delete oraclelinux7-x86_64-ksplice
Channels
--------
oraclelinux7-x86_64-ksplice
$ spacecmd -q -- softwarechannel_list
oraclelinux7-x86_64
oraclelinux7-x86_64-addons
oraclelinux7-x86_64-optional
oraclelinux7-x86_64-patch
oraclelinux7-x86_64-spacewalk24-client
oraclelinux7-x86_64-spacewalk24-server
oraclelinux7-x86_64-uek-r3
oraclelinux7-x86_64-uek-r4

The -q option suppresses informational messages. The -y option specifies that you would answer yes to all prompts to confirm that you want to delete or change data. By default, spacecmd assumes the answer no.

For more information, see the spacecmd(1) manual page.