Creating remote shell scripts


Remote shell scripts run on the target server and perform actions specific to the target server. Remote shell scripts can be written in any programming language that is supported by the system that runs the appropriate step.

You can create new automation categories to sort your remote shell scripts. In addition, you can use one of your existing scripts with a Template type as a template for creating new scripts.

When creating remote shell scripts, you can use:

  • %% in the shebang line (#!). When BMC Release Process Management dispatches the file, the %% variable is then replaced with a script file name.

    Example

    #![.bat] cmd.exe /c "%MW_HOME%\server\bin\setWLSEnv.cmd && java weblogic.WLST %%"
    #### begin of script body ####
    ......
    #### end of script body ####

  • pack_response routine—Updates values for output arguments. You can use this routine for updating only one output argument value at a time. The routine is used with the echo command in the following format: echo "pack_response 'outputArgumentName'outputArgumentValue'" .

    Example
    echo "pack_response 'jira_tickets' 'JPET-1: Add Link, JPET-2: Add Fish Icon'"

To create a new remote shell script

  1. Go to Environment > Automation.
  2. On the right pane, click Create Automation.
  3. In the To use as list, select Remote Shell.
  4. In the Choose Automation Category list, select one of the available automation categories.
  5. In the File Path box, enter the directory path for exporting or importing the automation script.
  6. In the Apply template list, select a template that you want to use as a base for creating your script. 
  7. In the Script integration server list, select that integration server that you want to use for connecting with the external system.

    Notes

    • When you select a server from the list, the details related to that integration server are automatically added to the script body.
    • You cannot add an integration server if the script body is empty.
    • A script that you do not plan to use for performing some actions in a particular target external system does not require an integration server.
  8. In the Script Name box, enter a unique name for the script.
  9. In the Description box, enter a short description for the script.
  10. In the OS Types list, select one or more operational systems used by the target server.
    To select several OS types, hold Ctrl.
  11. In the Script body area, enter the code for the automation that runs in a step.
  12. In the Script type list, select one of the following options as appropriate:
    1. Template—To save this script as a template for future use.
    2. System—To save this script as a base script that can be only viewed or copied but not modified by anyone apart from the Administrator.
    3. User—To save this script as a normal script for your personal use and available for viewing, copying, and modifying. 
  13. To save the script, click Add script.
  14. (Optional) To make the script available for other users, change the automation script status to the state other than Draft.

 

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