Adding an external command to a BLPackage


Using the BLPackage editor, you can add an external command to a package. An external command is any type of command that can be issued on a command line interface.

For example, if you are deploying a package to a web server, you might include an external command to restart the web server, as shown in this example.

g_v95_externalCommand.gif

An external command can be positioned in a BLPackage so it executes at the time items in the BLPackage are processed. For example, you can create one external command positioned at the beginning of a BLPackage that stops Windows services before the BLPackage is installed. Then you can create a second external command positioned at the end of the BLPackage that starts Windows services after the BLPackage is installed.

The following commands are additional examples of commands that you might find useful in your BLPackage:

  • After restarting the web server, set the JAVA_HOME environment variable:
    SET JAVA_HOME=C/Java
  • Install a JRE that you previously downloaded:
    cd /tmp/download;jre6.msi
Warning

Note

The cd command does not work as an external command because an external command executes in a different process than the transactions in a BLPackage, which execute in the current working directory for the BLPackage.

To add an external command

  1. Right-click in the hierarchy view and select Add > External Command from the pop-up menu.
  2. In the right pane, enter a value for any of the following:

    • Name — optionally provides a name for the command.
    • Cmd — provides the command or script to be executed when the BLPackage is deployed.
    • UndoCmd — provides the command or script to be executed when the BLPackage deployment is undone.

    When entering a longer command or script, you can click Browse g_V95_BrowseIcon.gifto display an Edit window. It provides a larger space for entering text. You can also use the Edit window to import an existing script.
    While entering the text of an external command, you can include a reference to a property value that is resolved when the script runs. To do this, enter a variable for the property, bracketed with double question marks (such as ??WINDIR??/rsc). Alternatively, you can click Select Property g_V95_SelectPropertyIcon.gifto find and enter the appropriate property.

    Warning

    Note

    External commands are run on the target as shell scripts (.bat on Windows and .sh on Linux or UNIX). The contents of the command and the values of properties included in the command are subject to the standard limitations in the use of special characters that exist for each shell type. For example, to use the percent % character on a Windows target, you must escape it with another % character. 

  3. If necessary, enter a value for ActionOnFailure (see Setting-action-on-failure).
  4. Move the external command to the correct position in the BLPackage (see Moving-an-object-within-a-BLPackage).

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*

TrueSight Server Automation 20.02