美文网首页
shell脚本循环遍历日期,用于sqoop脚本

shell脚本循环遍历日期,用于sqoop脚本

作者: 茂盛哥哥 | 来源:发表于2019-05-29 11:17 被阅读0次

    #! /bin/bash

    first="$1"

    second="$2"

    while [ "$first" != "$second" ]

    do

    date=`date -d "$first" +"%Y-%m-%d"`

    sqoop export \

    --connect jdbc:mysql:// \

    --username \

    --password \

    --table dwd_fact_front_orderinfo \

    --export-dir /user/hive/warehouse/dwd.db/dwd_fact_front_orderinfo/day="$date" \

    --input-null-non-string '\\N' \

    --input-null-string '\\N' \

    --input-fields-terminated-by "\t" \

    --update-key id \

    --update-mode allowinsert \

    --m 1;

    let first=`date -d "-1 days ago ${first}" +%Y%m%d`

    done

    相关文章

      网友评论

          本文标题:shell脚本循环遍历日期,用于sqoop脚本

          本文链接:https://www.haomeiwen.com/subject/bhducqtx.html