Malik_Abdul_8942

Alerting on an external Linux script's error return code

Discussion created by Malik_Abdul_8942 on Sep 12, 2017
Latest reply on Sep 13, 2017 by Wolfgang_Brueckler_1288
Question

We have a job executing a Linux script on a RHEL 6x node and UC4 returns a successful code even if the script fails. Since it is only executing the script is there a way for Automation Engine to key off a return code from the script to alert if it fails? if not, what are other customers utilizing to monitor Linux/Unix script failures via Automation Engine? Any help/direction is much appreciated.

Solution

You have to throw error message in your script ( for example https://www.cyberciti.biz/faq/shell-how-to-determine-the-exit-status-of-linux-and-unix-command/ ) so it will be shown in the report and then you will postprocess the report in the Post-process page of the JOB. Here is an example which does just that. 

Please read this documentation page thoroughly. 



https://docs.automic.com/documentation/webhelp/english/AWA/12.0/DOCU/12.0/AWA%20Guides/help.htm#AWA/Objects/obj_ProcessPage_Post.htm 

Docu snippet 

“The end of a job can still be influenced with post-script commands. The job return code and status text (the text supplied by the Job Messenger in the Trailer) can be modified subsequently, for example. The :MODIFY_STATE script statement, which was developed exclusively to be used on this page, defines the final ending of the job. 
For example, reports can be analyzed with PREP_PROCESS_REPORT. If an error is found, the ENDED_NOT_OK status could be defined for a job, although it has already ended normally a technical point of view and viceversa. The return code 0 is assigned to canceled jobs because the job being canceled is irrelevant for processing. 
With the :RSET script statement, script variables can be transferred between the Process and Post Process pages. This script statement returns the value which has been assigned to the script variable in the Process page.”

Outcomes