123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #! /bin/bash
- . /mnt/datadisk0/saga/bi_saga/dwh_saga/task_day/config.sh
- startDate=$1
- endDate=$2
- startSec=$(date -d "$startDate" "+%s")
- endSec=$(date -d "$endDate" "+%s")
- source /etc/profile.d/saga_env.sh
- for((i=$startSec;i<=$endSec;i+=86400))
- do
- current_day=$(date -d "@$i" "+%Y-%m-%d")
- start_time=$(date -d "0 day $current_day" +%Y%m%d)000000
- end_time=$(date -d "1 day $current_day" +%Y%m%d)000000
- echo current_day:"$current_day"
- echo start_time:"${start_time}"
- echo end_time:"${end_time}"
- echo "*******************能源数据需要减掉8小时*******************"
- energy_start_time=$(date -d "-1 day $current_day" +%Y%m%d)160000
- energy_end_time=$(date -d "-0 day $current_day" +%Y%m%d)160000
- echo energy_start_time:"${energy_start_time}"
- echo energy_end_time:"${energy_end_time}"
- # 执行某天的数据导入 hbase —> mysql
- # sh /mnt/datadisk0/saga/bi_saga/dwh_saga/task_day/py_mysql.sh energy --start_time $energy_start_time --end_time $energy_end_time
- # mysql -> hive
- # sh /mnt/datadisk0/saga/bi_saga/dwh_saga/task_day/mysql_to_hdfs.sh ods_energy_15_min $current_day
- # ods -> dwd
- # ssh hadoop01 sh /mnt/datadisk0/saga/bi_saga/dwh_saga/task_day/ods_to_dwd.sh all $current_day
- # 清理当天mysql中的数据
- # ssh hadoop01 sh /mnt/datadisk0/saga/bi_saga/dwh_saga/task_day/clean_mysql.sh clean_energy_15 $current_day
- # hive -> mysql
- # sh /mnt/datadisk0/saga/bi_saga/dwh_saga/task_day/hdfs_to_mysql.sh app_energy_day $current_day
- done
|