Postscript

HCL UnO agent creates the postscript file after installation. You can utilize the file to run a task or a series of operations automatically. The file lists environment variables that you can set as conditions, and example commands with explanatory comments. The values of these variables are dynamic and change after a task runs.

Each time when a task runs, the environment variable values change. You can utilize this dynamic change to run a task with the help of the postscript file. Add or edit the commands or specify task definitions in the postscript file with conditions. By setting specific conditions based on the environment variable values, and as the values change after a task runs, it runs the task specified in the file. The file acts as a control mechanism to run the task specified in the file when the predefined conditions are met, and each time a task runs, the following environment variables are changed:
  • UNO_JOB_RETURN_CODE: Indicates the task status after completion. For more information, see Orchestration CLI return codes.
  • UNO_JOB_SPOOL_DIR: Indicates to the directory where temporary data related to the task is stored.
  • UNO_JOB_ID: A unique identifier assigned to each task.

By setting conditions based on the values of the environment variables, you can create customized task automation workflows. For example, you can send an email notification for task failures or to transfer task logs. Moreover, you can define multiple commands within the script to create complex task scenarios.

The combination of these three key variables: UNO_JOB_RETURN_CODE, UNO_JOB_SPOOL_DIR, and UNO_JOB_ID provides a flexible and powerful configuration framework. You can create a wide range of automated conditions, to make more tailored and sophisticated task workflows.

Example:
  1. To send a mail when a task fails, configure the postscript file as follows:
    echo "------------------------------------------------------------"
    echo "Running UnO Agent Post Job Script for job $UNO_JOB_ID"
    echo "------------------------------------------------------------"
    
    if "%UNO_JOB_RETURN_CODE%"=="0" (goto :out) else (goto :email)
    
    :email
    c:\"Program Files"\utils\bmail.exe -s smtp.yourcompany.com -t %EMAIL_ID% -f %COMPUTERNAME%@yourcompany.com -h -a "Subject: Job %UNO_JOB_ID% abended" -b "Job %UNO_JOB_ID% abended"
    goto :out
    
    :out\
    exit %RETVAL%