AutoSys job fails on exit code 0 when success_codes is defined
search cancel

AutoSys job fails on exit code 0 when success_codes is defined

book

Article ID: 196875

calendar_today

Updated On:

Products

CA Workload Automation AE - System Agent (AutoSys) CA Workload Automation AE - Scheduler (AutoSys) Workload Automation Agent Autosys Workload Automation

Issue/Introduction

An AutoSys job fails with a generic "Exit Code 1" (Failure) status even though the application or script completed successfully and returned an exit code of 0. The user expects exit code 0 to be a success regardless of other configurations.

insert_job: test_job  job_type: CMD
command: ls /testfolder/folder2/us/file.dat
machine: machine-name
permission: gx,ge,wx,we,mx,me
date_conditions: 0
description: "Check for file.dat file"
std_out_file: "> /tmp/$AUTO_JOB_NAME.out"
std_err_file: "> /tmp/$AUTO_JOB_NAME.err"
alarm_if_fail: 1
success_codes: 1

Environment

Product: AutoSys Workload Automation (AE)
Component: Scheduler / Agent
Attribute: success_codes

Cause

This behavior is by design. In AutoSys, the interpretation of exit codes follows a strict precedence logic:

  1. If success_codes is defined: AutoSys considers ONLY the codes listed in that attribute as a success.
  2. Implicit Failure: Any exit code not explicitly listed in the success_codes attribute is automatically treated as a failure.

If a job definition contains success_codes: 1, AutoSys will treat an exit code of 0 as a failure because 0 was not explicitly granted "success" status in the job definition.

Resolution

To resolve this, you must modify the job definition (JIL) to include all codes that should represent a successful completion.

  • Option 1: Include Exit Code 0 in success_codes
    Modify the attribute to include both your custom code and the standard success code (0).

    /* Example: Accept both 0 and 1 as success */

    update_job: job_name
    success_codes: 0,1

  • Option 2: Use fail_codes Instead
    If you only want a specific code to trigger a failure and want all other codes (including 0) to be successful, use the fail_codes attribute instead.

    /* Example: Only exit code 2 is a failure; everything else is success */

    update_job: job_name
    fail_codes: 2

  • Option 3: Remove success_codes
    If the job should follow the default AutoSys behavior (exit code 0 = Success, non-zero = Failure), remove the success_codes attribute entirely.

Verification

  1. Run autorep -J <job_name> -q to verify the JIL change.
  2. Force start the job.
  3. Verify the status transitions to SUCCESS when the application returns code 0.

Additional Information

For further assistance, see Contact Broadcom Support.
To speak with a customer representative or a Support Engineer see Contact Support. Scroll to the bottom of the page and click on your respective region.