This article address: http://blog.csdn.net/hblfyla/article/details/71709252, reprint please mark the original address
Example One:
#!/bin/sh
If [$#-ne 2];then
startdate= ' date--date= ' 1 days ago ' +%y-%m-%d ' enddate= '
date +%y-%m-%d
' else
startdate=$1
enddate=$2
fi while
[[$startdate < $enddate ]]
do
echo ###### # # $startdate ######### "
echo" clean data "
Hadoop jar Xxxx.jar $startdate
hive-e" Xxxxxxxxxxxxxxxxxxxxxx "Done
Example two:
#!/bin/sh
If [$#-ne 2];then
startdate= ' date--date= ' 1 days ago ' +%y-%m-%d ' enddate= '
date +%y-%m-%d
' else
startdate=$1
enddate=$2
fi while
[[$startdate < $enddate ]]
do
echo ######## $startdate ######### "
#日期转换
hdfsstart= ' date-d ${startdate} +%y/%m/%d ' hdfsend= ' date-d '
-1 day ago ${ Hdfsstart} "+%y/%m/%d '
java-jar xxxxx.jar ${hdfsstart} ${hdfsend}
sh xxxxx/xxxxxx.sh ${startdate}
Hadoop jar xxxxxxxxx ${startdate}
hive-e "xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
startdate= ' date-d ' +1 Day $ StartDate "+%y-%m-%d ' done