When running a script on LINUX/UNIX System Agent, the job returns error code (or completion code) 1 and there is no output in spool

Document ID : KB000049531
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

When UNIX/LINUX CA Workload Automation System Agent executes a shell script it returns exit code 1.

The agent does not capture any output from the script (if there is one expected) in the spool file.

Solution:

When a LINUX/UNIX shell script is executed, the output must be compared with the script execution from a console or a terminal. When a script is executed by the System Agent, the output may differ since the environment has changed. The shell script must be investigated if the System Agent does not capture any output.

There are several possible reasons when System Agent will not capture any output in the spool and also show the job exit code as 2. Here are some common ones:

  1. Shell has an interactive mode. The script may be forced to show the output to tty. E.g.

    echo "${Some output}" >/dev/tty

  2. All output has been redirected to /dev/null. E.g.

    echo "${Some output}" >/dev/null>2&1

Correct the out redirection accordingly and System Agent will be able to capture the job output.