oozie shell操作随机抛出语法错误

mfuanj7w  于 2021-06-03  发布在  Hadoop
关注(0)|答案(0)|浏览(177)

我有一个OozieShell操作计划每天运行,它执行一些配置单元命令并将结果输出到stdoutput,以便被其他操作捕获。但shell操作有时会随机失败,有时会出现语法错误,有时会成功。
任何帮助都将不胜感激!
shell脚本.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

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题