编写hadoop中补数离线运行脚本

来源:互联网 发布:php用逗号分割字符串 编辑:程序博客网 时间:2024/06/18 10:51

本文地址:http://blog.csdn.net/hblfyla/article/details/71709252 ,转载请标记原文地址


范例一:

#!/bin/shif [ $# -ne 2 ];then        startdate=`date --date='1 days ago' +%Y-%m-%d`        enddate=`date +%Y-%m-%d`else        startdate=$1        enddate=$2fiwhile [[ $startdate < $enddate  ]]do        echo "########$startdate#########"    echo "clean data"    hadoop jar xxxx.jar $startdate       hive -e "xxxxxxxxxxxxxxxxxxxxxx"done



范例二:

#!/bin/shif [ $# -ne 2 ];then        startdate=`date --date='1 days ago' +%Y-%m-%d`        enddate=`date +%Y-%m-%d`else        startdate=$1        enddate=$2fiwhile [[ $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


0 0
原创粉丝点击