How to send the mail's body as fail when the condition fails?
0
I have an S3 bucket....in which files will be uploaded daily and i should mail them...Mail is working fine...But when the file is not uploaded the mail is sent with empty mail body...How can i put as "fail" in the mail's body...when the condition fails aws s3 ls s3://project/js/Historical/$(date +%Y)/$(date +%m)_$(date +%B/) | grep ${DATE} | sort -rh | head -n 2 | awk {' print $1"t"$2"t"$4'} | mail -s "s3" "abc@gmail.com" The above code mail the files daily if it is uploaded...but if the files are not uploaded it sends with empty mail's body....but if the file is not uploaded i should mail as "fail" how to do that. I tried in loop it is not working for me
linux bash centos
...