Universal Command - Command References

Overview

A command reference is a file residing on the system Universal Command (UCMD) Server installed that contains a pre-defined command or script to be executed at the request of a Universal Command Manager.

The UCMD Manager requests execution of a command reference by specifying:

  • The name of the command reference with the COMMAND option.
  • The command type as a command reference with the COMMAND_TYPE option.

The UCMD Server finds the command references in the configured command reference location, as specified in the UCMD Server CMD_REFERENCE_DIRECTORY option. If the command reference is found, the UCMD Server executes the command or script defined in the command reference.

The UCMD Manager does not provide its own command or script to execute. It only provides the name of a command reference. This provides the ability to precisely control what UCMD Managers can execute on the server. The UCMD Manager does not have the ability to specify the commands executed on the system. It can only reference a pre-defined command reference that has been defined by the UCMD administrator for the system.

A command reference also can specify that the command or script accepts options or command line arguments from the UCMD Manager.

Command Reference Sections

A command reference is a sequential file containing two sections:

  1. Options Section
  2. Command Section

The sections are separate with a logical end-of-file marker. The logical end-of-file market is the string <eof>.

Options Section

The Options section contains #Command Reference Options that define the command reference and specify operational characteristics. It also can contain comments.

Syntax Rules

Syntax rules for the Options section are:

1

Lines starting with a hash character (#) are comments.

2

Blank lines are ignored.

3

Options are specified with a Name followed by a Value.

4

Names are prefixed with a hyphen (-).

5

Names are case-insensitive.

6

Values are case-insensitive.

7

One or more spaces must separate the Name and Value.

8

Options section is ended with <eof> at the start of a line.

Command Reference Options

The following table provides a description and values for all command reference options.

Name                

Description

Values

-format

Format of the Command Section.
 
This option is required.

Valid values are:

  • cmd
    Command section contains a command.
  • script
    Command section contains a script. The script is defined in the same format as if it was being defined normally in a self-contained file.

-type

Type of command or script in the Command Section.
 
This option is not required.

Values depend on the UCMD Server operating system.

See the UCMD Server COMMAND_TYPE and SCRIPT_TYPE options for description of valid values.

-allow_options

Specification for whether or not the command or script accepts user-provided options or command line arguments from the UCMD Manager.
 
This option is not required.

Valid values are:

  • yes
    Options are passed.
    • For commands, the UCMD Manager options are concatenated to the end of the command.
    • For scripts, the UCMD Manager options are passed to the script as command line arguments.
  • no
    Options are not passed. This is the default.

Command Section

The Command section contains the command or script (as specified by the -format command reference option) to be executed.

Commands

Commands are single commands that are executed based on the -type option.

The command may span multiple lines. No line continuation characters are required. All lines will be concatenated together to form one command line.

Scripts

Scripts are read verbatim and placed into a temporary file. The temporary file is passed to the script processor for the appropriate script type, as specified by the -type option.

Command Reference Example

The following figure is an example command reference that executes a Windows DIR command. The two sections are separated with a logical end-of-file marker, <eof>.

# Comments describing the command reference.
#
# Execute the DIR command.
#

-format         cmd
-type           shell
-allow_options  no
  
<eof>

DIR

Command Reference Request

A UCMD Manager requests the execution of a command reference just as it does for other command types: via the COMMAND_TYPE option. A COMMAND_TYPE value of cmdref specifies that the COMMAND option value is referring to a command reference.

Examples

The following examples illustrate how a UCMD Manager for UNIX would invoke a command reference.

Executing a command reference with no options

The following example executes a command reference named cmd100. The -cmd option specifies the name of the command reference file on the remote system and the -cmd_type option specifies that -cmd is referring to a command reference.

ucmd -cmd cmd100 -cmd_type cmdref ...

Executing a command reference with options

The following example executes a command reference named cmd100. The -cmd option specifies the name of the command reference file on the remote system and the -cmd_type option specifies that -cmd is referring to a command reference. Two command line options are passed to the command reference, opt1 and opt2.

ucmd -cmd "cmd100 opt1 opt2" -cmd_type cmdref ...

The actual format of the options, opt1 and opt2, depend on the command or script being executed in the command reference. In some cases, the options may be required to be comma separated and, other cases, space separated.

Command Line Options

The command line options used in these examples are:

Option

Description

-cmd

Command to execute on the remote system.

-cmd_type

Type of command specified by -cmd.

UACL Rules

Command references can be protected with Universal Access Control List (UACL) rules. Access can be denied or allowed based on the command reference name (see Universal Access Control List for details).