我有一个oozie shell动作,计划每天运行,执行一些hive命令,并将结果输出到stdoutput,以便被其他动作捕获。 但shell动作随机失败,有些日子会出现语法错误,其他日子也会成功。
任何帮助将不胜感激!
Shellscript.sh
#!/bin/sh
ctr=0
loop=3
while [[ -z $personahistmaxdate || -z $offeritemdimmaxdate || -z $stgfirstgamedatemaxdate ]] && [[ ${ctr} -lt ${loop} ]];
do
echo $ctr
personahistmaxdate=$(hive -e 'use identity; show partitions persona_hist;'|awk -F'|' '{print substr($1,length($1)-9, 10)}'|tail -1)
echo "personahistmaxdate=$personahistmaxdate"
offeritemdimmaxdate=$(hive -e 'use offer_item; show partitions offer_item_dim;'|awk -F'|' '{print substr($1,length($1)-9, 10)}'|tail -1)
echo "offeritemdimmaxdate=$offeritemdimmaxdate"
stgfirstgamedatemaxdate=$(hive -e 'use shooter_taxonomy_stg; show partitions stg_firstgamedate;'|awk -F'|' '{print substr($1,length($1)-9,10)}'|tail-1)
echo "stgfirstgamedatemaxdate=$stgfirstgamedatemaxdate"
ctr=`expr $ctr + 1`
done
##Script to Handle if any of the variables is null then exit the shell
if [[ -z $personahistmaxdate || -z $offeritemdimmaxdate || -z $stgfirstgamedatemaxdate ]]
then
echo "empty date in one of the variables"
exit 1
fi
Oozie日志错误
stderr logs
./showpartitions.sh: 17: [[: not found
./showpartitions.sh: 17: -z: not found
./showpartitions.sh: 17: -z: not found
./showpartitions.sh: 23: [[: not found
./showpartitions.sh: 23: -z: not found
./showpartitions.sh: 23: -z: not found