Job is failed with Exit code 1


Article ID: 196875


Updated On:


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


Job fails with Exit code 1 while the Exit code 0 is reported in the agent log file.

The job definition: 

insert_job: jobname  job_type: CMD

box_name: boxname 
command: ls /appl/sap/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: 2


Release : 11.3.6

Component : CA Workload Automation AE (AutoSys)


The "Exit Code 1" is simply a "Generic Exit Code" which means the job failed and this can be for any reason.

In the joblog however, we can find the script completed with an "Exit code 0" which means "No errors" on the execution of the script on the Agent:


Sat Aug 1 16:44:20 2020 CAWA_I_20018 Job failed. Exit code 0, Status:

This means that the job ran without any problems on the Agent and returned the “Exit code 0” which means “No errors” as a general rule.

However, in your job definition you have set “success_codes: 2”:

insert_job: GTS-GEO-SC-ZASNS-CHECK-C11-C-01

job_type: CMD

command: ls /appl/sap/us/asnesap_geo_h.dat


success_codes: 2 < =====

This means that for the job to be considered as “success” you need the following command to return the “Exit code 2”:

command: ls /appl/sap/us/file.dat < =====

You will need to investigate the reason why the command:

ls /appl/sap/us/file.dat

is expected to return an exit code 2 and why it returns 0 instead of 2 since you have begun to encountered the issue.

This is Not an AuoSys issue and needs to be investigated at your scripts level.

However, you can use the information reported in standard files if any for more information:

std_out_file: "> /tmp/$AUTO_JOB_NAME.out"

std_err_file: "> /tmp/$AUTO_JOB_NAME.err"

The exit code is zero in agent log because the script was ran successfully by the agent without any errors.

The reason why there is an error code 1 reported in the event_demon log is that you have set the following attribute in your job definition:

success_codes: 2 < =====

This means that AutoSys will consider the job as Success “Only” when the Scripts Return code is 2 per your job definition.

Otherwise the job will be considered as failed and the generic Exit Code 1 will be sent which means failure per your job definition.

This is Not an AutoSys issue. AutoSys is behaving exactly as expected.

You will need to investigate why your script is supposed to return the Exit Code 2 and why it does not do that.