标签:while upd gen ndt star hang export cut cas
#######################################################
####################################
##control
##create by zhangpengfei
EBIHOME=/dwdata/dwetl_v5/agent_A01/update/141127_EBI/EBI
LOG=/dwdata/dwetl_v5/agent_A01/update/141127_EBI/EBI_LOG
mon_max_day()
{
day=0
if [ $1 -gt 0 -a $1 -lt 13 ]
then
case $1 in
1|01|3|03|5|05|7|07|8|08|10|12) day=31;;
4|04|6|06|9|09|11) day=30;;
2|02)
if [ `expr $2 % 4` -eq 0 ]; then
if [ `expr $2 % 400` -eq 0 ]; then
day=29
elif [ `expr $2 % 100` -eq 0 ]; then
day=28
else
day=29
fi
else
day=28
fi;;
esac
fi
printf $day
}
endt_etl()
{
tx_date=$1
echo "$tx_date ETL Start!"
dy=`echo $tx_date|cut -c 1-4`
dm=`echo $tx_date|cut -c 5-6`
dd=`echo $tx_date|cut -c 7-8`
etl_dt=$dy-$dm-$dd
sh /home/rong/rdw/bin/run_hive.sh rmk t70_vw_risk_approve_duty_mnit $etl_dt
sh /home/rong/rdw/bin/run_hive.sh rpt t70_vw_risk_approve_duty_mnit $etl_dt
sh /home/rong/rdw/bin/run_sqoop_export_hive.sh rpt t70_vw_risk_approve_duty_mnit rdsst t70_vw_risk_approve_duty_mnit I 0 $etl_dt
}
strdt=$1
enddt=$2
sy=`echo $strdt|cut -c 1-4`
sm=`echo $strdt|cut -c 5-6`
sd=`echo $strdt|cut -c 7-8`
ey=`echo $enddt|cut -c 1-4`
em=`echo $enddt|cut -c 5-6`
ed=`echo $enddt|cut -c 7-8`
while [ $strdt -le $enddt ]
do
Max=`mon_max_day $sm $sy`
while [ $sd -ne $Max ]
do
##if [ $sd -eq 0 ] || [ $sd -eq 31 ];then
## endt_etl $strdt
## echo "********************Complete $tx_date !"
##fi
endt_etl $strdt
echo "********************Complete $tx_date !"
if [ $strdt -eq $enddt ];then
exit 0
fi
#########
sd=`expr $sd + 1`
if [ $sd -lt 10 ];then
sd=0$sd
fi
strdt=$sy$sm$sd
done
##########
if [ $sd -eq $Max ];then
sm=`expr $sm + 1`
if [ $sm -lt 10 ];then
sm=0$sm
fi
sd=0
fi
##########
if [ $sm -eq 13 ];then
sy=`expr $sy + 1`
sm=0
fi
done
标签:while upd gen ndt star hang export cut cas
原文地址:https://www.cnblogs.com/bjxdd/p/12131440.html