Universal Command Server for Windows - Commands
Overview
There are two types of work that a UCMD Server can execute:
- Commands and Scripts
- Command References
In all cases, the work executes in its own address space with its own user identity. No Universal Agent programs share the address space with the unit of work started by the UCMD Server.
Command Environment
The user command executes in its own process. No Universal Agent programs share the process with the user command. The process environment consists of several attributes that are described in this section.
User Identification
UCMD Server can operate with user security active or inactive, as specified by the USER_SECURITY configuration option.
- With user security active, the UCMD Server requires the UCMD Manager to supply a valid local system user account or a domain account and a password. The user command executes with the user account identified by the supplied user ID.
UCMD Managers specify a domain user account as DOMAIN\USER.
- With user security inactive, the UCMD Server does not require the UCMD Manager to supply a valid user ID. The user command executes with the user account of the UCMD Server. The user account of the UCMD Server is inherited from the Universal Broker.
The Universal Broker service can be configured to run as the Local System account or as an Administrative account with substantial authority. When the UCMD Server is configured to run with security inactive, the user process will inherit a lot of privileges which it may not need. Setting security inactive is not recommended because of the level of access it permits the user process.
Working Directory
UCMD Server can operate with user security active or inactive, as specified by the USER_SECURITY configuration option.
- With user security active, a user command's working directory is a subdirectory of the Universal Command Home directory, which defaults to
\Program
Files\Universal\UcmdHome
. The name of the subdirectory is the user ID with which the command executes. For example, if user HOGIN executes a command via Universal Command, the commands working directory is\Program
Files\Universal\UcmdHome\HOGIN
.
If the working directory is not defined when the user command executes, the UCMD Server creates the directory before it executes the user command.
- With user security inactive, a user command's working directory is the UCMD Server's working directory. All user commands executed use the same directory. Care should be taken to avoid name clashes or other consequences of multiple processes sharing a working directory.
Command Shell
The default command interpreter used to execute commands and scripts is CMD.EXE. This commonly is referred to as the DOS command processor. The path to the CMD.EXE program is obtained from the COMPSPEC environment variable, or if COMPSPEC is not defined, the path is derived from the WINDIR environment variable as %WINDIR\system32\cmd.exe
. If that fails, the server exits with an error.
Manager-supplied script files are processed as batch files (extension .BAT) by default. The file type (that is, the extension) can be changed with the SCRIPT_TYPE UCMD Server configuration option or the SCRIPT_TYPE UCMD Manager option.
Environment Variables
UCMD Server inherits its environment variables from the Universal Broker. In turn, the user command inherits its environment variables from the UCMD Server. The UCMD Server does not add, delete, or edit any environment variables.
Command References
A command reference is a file on a Universal Command (UCMD) Server system that contains a pre-defined command or script.
The UCMD Manager requests execution of a command reference by specifying:
- Name of the command reference, in the COMMAND option.
- cmdref (command reference) value, in the COMMAND_TYPE option.
The UCMD Server searches the system for its directory of command references, as specified in the UCMD Server CMD_REFERENCE_DIRECTORY option, and executes the command or script in the command reference.
The UCMD Manager does not provide a command or script; everything is defined within the command reference. This provides the ability to define and control precisely what is executed by the UCMD Server.
A command reference also can specify that the command or script accepts user-provided options / command line arguments from the UCMD Manager.
For example, the following UCMD Manager command can be used from Windows or UNIX to request execution of the command reference cref100 and pass it options opt1 and opt2:
ucmd -c "cref100 opt1,opt2" -cmd_type cmdref ...
Command references can define any valid command type, such as commands and scripts.
Command Reference Example
The following command reference executes a ucopy command to read a file.
# Command reference to read a file. # -format cmd -type shell
<eof>
ucopy \application\file.txt