I have a bash script that loops through a folder and processes all *.hql files. Sometimes one of the hive script fails (syntax, resource constraint, etc), instead of the script failing it will continue onto the next .hql file.
Anyway I can stop the bash from processing the remaining? Below is my sample bash:
for i in `ls ${layer}/*.hql`; do
echo "Processing $i ..."
hive ${hiveconf_all} -hiveconf DATE=${date} -f ${i} &
if [ $j -le 5 ]; then
j=$(( j+1 ))
else
wait
j=0
fi
done
Use this template for running parallel processes and wait for their completion. Add your
date
,layer
,hiveconf_all
and other variables:Then you will be able to inspect each process log individually.
add
to the top of your script
I would check the process completion state of the previous command and invoke the exit command to come out the loop
Introduce the above line after the hive command and should do the trick.