Return code of UNIX script not transmitted to the Job that launched it
search cancel

Return code of UNIX script not transmitted to the Job that launched it

book

Article ID: 115985

calendar_today

Updated On:

Products

CA Automic Workload Automation - Automation Engine

Issue/Introduction

"We have an issue during a Unix JOBS execution. The script executed by the job is returning an error code 1, but the Job is ending OK.
Is it normal ? If yes, how can I pass the error code of the script to the Job status ?"

 

Here is how the Unix job has been configured:

<Please see attached file for image>

User-added image

The jbu_test.sh is a simple script which only performs an "exit 1".
When we run it, the job is returning a ENDED_OK status:

<Please see attached file for image>

User-added image

And if we check the job report, we can see that the script is returning an error 1:

<Please see attached file for image>

User-added image

Environment

Automation Engine 12.0 and above.

Resolution

It is normal that the job is not retrieving the script status. To perform this, you should change the "echo $?" to a "exit $?":

<Please see attached file for image>

User-added image

When running, the job is now returning an ENDED_NOT_OK status, according the status of the script launched in it:

<Please see attached file for image>

User-added image

Attachments

1558695201503000115985_sktwi1f5rjvs16i1s.png get_app
1558695199676000115985_sktwi1f5rjvs16i1r.png get_app
1558695197914000115985_sktwi1f5rjvs16i1q.png get_app
1558695196207000115985_sktwi1f5rjvs16i1p.png get_app
1558695194220000115985_sktwi1f5rjvs16i1o.png get_app