#!/bin/bash
# @author: liukai
# @date  : 17-09-22
# # # # # # # # # # # # # # # # # # # # # #

LOG_TIME=$(date +%Y%m%d -d "-1 day $ScheduleTime")
year=${LOG_TIME:0:4}
month=${LOG_TIME:4:2}
day=${LOG_TIME:6:2}
DIM_CATEGORIES_PACKAGE_3S=s3://mob-emr-test/dataplatform/DataWareHouse/data/dwh/dim_categories_package_3s
mysql -hreplica-portal-mysql-external.mobvista.com -udatacenter -pPr3j5KcQlM13 -P3306 -D mob_portal -e"
       select id,uuid,platform,package_name,case when categories !='' then categories when categories ='' then '-' end as catego from mob_camp_info  where length(package_name)>3;">>./categories.txt

OUTPUT_PATH="${DIM_CATEGORIES_PACKAGE_3S}/tmp/"
hadoop fs -mkdir ${OUTPUT_PATH}
hadoop fs -put -f ./categories.txt ${OUTPUT_PATH}

rm ./categories.txt
