#!/bin/bash

source ../dmp_env.sh

today=${ScheduleTime:-$1}

start_time=$(date +"%Y-%m-%d 00:00:00" -d "-7 days $today")
end_time=$(date +"%Y-%m-%d %H:59:59" -d "-1 hours $today")

if [[ ! -d "/home/hadoop/wangjf/RTDmp/data" ]]; then
  mkdir -p /home/hadoop/wangjf/RTDmp/data
fi

java -Xmx6144m -cp ../${JAR} mobvista.dmp.datasource.rtdmp.RTDmpFetch "${start_time}" "${end_time}"

if [[ $? -ne 0 ]]; then
    exit 255
fi