Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved


Chapter 5 General Activities Palette : External Command

External Command
Activity
The External Command activity allows you to execute an operating system command. This activity waits for the command to complete before transitioning to the next activity. Optionally, the command output and any errors can be included in this activity’s output schema, written to a file, or both.
Long-Running Commands
If you want to execute long-running commands (such as daemons), it may not be practical to execute the command directly. Because the specified command must terminate before control is passed to the next activity, the process instance must run until the external command completes. To avoid this problem, you may want to create a script that runs the desired commands in the background.
The syntax of executing commands as background processes differs by operating system. For example, on UNIX, to run a command in the background, you append the ampersand character (&) to the command. On Microsoft Windows, you use the START command in a batch file to run a command in a different process.
After creating a script to run commands in the background, specify the script as the command to run in the External Command activity. The script runs the desired command and returns the process ID of the process it started. The return code of the script is stored in the returnCode item of the External Command activity’s output.
If you want to start a long-running command in the background and then later terminate the background process, you should store the process ID returned by the script in a file or database table. Another process instance can then read the process ID and kill the process with the appropriate operating system command when necessary.
Configuration
The Configuration tab has the following fields.
You can specify a global variable for this configuration field. This allows you to easily specify different commands on different operating systems. For example, you may specify %%EXTERNAL_COMMAND%% as the value for this field. On MS Windows, the value of the global variable may be the following:
If the command to execute is not located in one of the directories specified in the PATH environment variable (on UNIX or Windows), you can specify the full path for the executable command or you can use the environment input element to specify the environment for the command.
Input
See TIBCO ActiveMatrix BusinessWorks Process Design for more information about mapping and transforming input data.
The input for the activity is the following.
For example, on UNIX, typing sed into a command prompt allows you to enter more text as input into the sed command.
Use &crlf; in the string for this item to specify a carriage return (that is, &crlf; simulates pressing the Enter key).
The environment variable settings used for running the command. This element is specified as a comma-separated list of <name>=<value> pairs where <name> is the name of the environment variable and <value> is the value of the environment variable.
\r — newline carriage return character
\n — newline character
\t — tab character
\\ — backslash character
For example, \r\n signifies to split at a carriage return/linefeed, \\ signifies to split when a backslash is encountered.
Output
The output for the activity is the following.
Any output produced by the command and sent to stdout. This output item is only available if the Make Output Available as Activity Output field is checked on the Configuration tab.
Any errors produced by the command and sent to stderr. This element is only available if the "Make Output Available as Activity Output" field is checked on the Configuration tab.
Error Output
The Error Output tab lists the possible exceptions that can be thrown by this activity. See TIBCO ActiveMatrix BusinessWorks Error Codes for more information about error codes and corrective action to take.

Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved