alexa
Facebook
Twitter
LinkedIn
Instagram
Whatsapp
Call Now
Quick Inquiry

AWS Batch job is marked as successful when in fact its log shows that it failed in python ?

AWS Batch job is marked as successful when in fact its log shows that it failed in python ?

Add set -euxo pipefail in the first line after the shebang of your bash script and it will fail if any of your statements fail.

More information  about what those set flags mean.

Actually to solve your question just set -e could be enough in some cases, but the other additional flags are also nice to have in most cases (as in the example below which does not fail just with set -e, you need set -eu).

One example script below:

 #!/usr/bin/env bash
set -euxo pipefail
echo $UNDECLARED VARIABLE
echo "Script does not reach here" 

If you run above script you will get this error: UNDECLARED: unbound variable. However without set -euxo pipefail script will exit with success error code (echo $? will return zero because the last statement was executed without errors).


48 0
7

Write a Comments


* Be the first to Make Comment

GoodFirms Badge
GoodFirms Badge

Fix Your Meeting With Our SEO Consultants in India To Grow Your Business Online