Universal Command Server for UNIX - 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.
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 user ID for the local system and a password. The user command executes with the user ID and the primary and secondary group ID's of the 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 the superuser account (UID 0).
The superuser account provides a lot of access to the operating system that a user process typically does not require. Setting security inactive is not recommended because of the level of access it permits the user process.
Working Directory
The working directory of a user command depends on whether user security is active or inactive:
- With user security active, a user command's working directory is the home directory of the user ID as defined in the
/etc/passwd
file. - 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 and other consequences of multiple processes sharing a working directory.
Command Shell
The UCMD Manager LOGIN option and UCMD Server LOGIN option specify what shell is used.
For non-login environments, the default is shell /bin/sh. The shell used for non-login environments is configurable with the SHELL option.
For login environments, the shell associated with the user ID found in the /etc/passwd file is used. The shell environment is created as if the user logged on interactively. For example, the korn shell's .profile is used to initialize the environment.
The non-login environment is similar to the environment the cron scheduler provides. User resource files, such as .profile, are not utilized.
The application scripts being executed and your local system management policies should be used to determine which method is best.
If user security is inactive, the default shell /bin/sh always is used independent of the LOGIN option.
Environment Variables
Environment variables are inherited from the server, which in turn inherits them from the broker.
If security is active, certain variables are modified to match the user environment. They are HOME, LOGNAME, USER, PWD, and SHELL. Their values are updated to reflect the values for the new environment.
The following variables are added if not found in the environment: HOME, USER, SHELL, and UCMDENV. The UCMDENV variable is set to a value of 1. It can be used within scripts to determine if Universal Command has invoked them.
The UCMD Manager LOGIN option and UCMD Server LOGIN option have an impact on the environment variables defined. For login environments, the user's shell is invoked as a login shell, which, in turn, uses the shell .profile file in the user's home directory. Therefore, any environment variables set in the .profile file also will be defined. UCMD Server inherits its environment variables from the Universal Broker. In turn, the user command inherits its environment variables from the UCMD Server.
If user security is inactive, no changes are made to the 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.
For a complete discussion of Command References, see Command References.
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