execute/4—run a program as an external process
The execute/4
primitive runs a program as an external process.
execute($EVENT,$PROG,$ARGS,$ACTEVT)
execute/4 arguments
Argument | Mode | Type | Description |
---|---|---|---|
| Input | OBJECT | Specifies the object handle for the event on which the action is to be performed |
| Input | STRING | Specifies the name of the external program to be run |
| Input | LIST_OF ANY | Action argument list. |
| Input | STRING | YES|NO |
Environment variables for Execute primitive
When creating an executable, you can use the environment variables listed in the following table in the executable script or program:
Available environment variables in Execute rules
Variable | Description |
---|---|
| Build number found in the About dialog box of the console |
| Date of the build |
| Name of the cell |
| Release number for the cell, for example 1.1 |
| Class of the event under analysis |
| Home directory of the requestor |
| Log file name |
| Home directory where the cell resides |
| Name of the rule package |
| Requestor of the external action |
| Name of rule that triggered the external action |
| Shell program |
| List of slot names for the class |
| Terminal type (for UNIX only) |
| Window ID for the requested console |
All slots are passed in the environment in the form of variables (with the same names as their slot names) containing the slot values.
All variables that exist in the environment in which the cell is started are also passed, but they cannot be enumerated because they are determined by the actual runtime environment.
All external action primitives have the same environment. All variables from the initial cell startup environment are passed to the environment of external actions launched from the cell.
Use execute/4
to run the program specified in the $PROG
argument as an external process on the event with the object handle specified in the $EVENT
argument.
The program location is determined in the following order:
- <Infrastructure Management server installation directory>\pw\server\etc\<pn_cellName>\kb\bin\ [l\w\p\s\h]
l\w\p\s\h indicate the operating system specific directory:- l: Linux
- w: Microsoft Windows
- p: AIX
- s: Solaris
- h: HP-UX
- If the program is not found in any of the directories specified in Step 1, the
execute
function looks for the program in the <Infrastructure Management server installation directory>\pw\server\etc\<pn_cellName>\kb\bin\A directory. - If the program is not found in any of the directories specified in Step 1 or Step 2, the
execute
function looks for the program in the <Infrastructure Management server installation directory>\pw\server\etc\bin directory. - The execute program displays an error message if the program is not found in any of the directories specified in Step 1, Step 2, or Step 3.
The execute/4
call terminates immediately when the external process has been set up, even if the program is not yet finished. The remainder of the rule is executed.
When the program is executed, all slots are setup as environment variables automatically. In addition, some system-defined variables are available.
If the $ACTEVT
argument is specified as YES, an MC_CELL_ACTION_RESULT event will be created. On termination of the program, the MC_CELL_ACTION_RESULT event will be updated with the result.
execute/4 example
execute($E,mc_modslot,[msg,'Hello'],NO);
Comments
Log in or register to comment.