#!/bin/sh

# # # # # # # # # # # # # # # # # # # # # #
# @author : jiangfan
# @date : 2020-11-24 15:00:51
# # # # # # # # # # # # # # # # # # # # # #

source ../../dmp_env.sh

LOG_TIME=$(date -d "$ScheduleTime" +"%Y-%m-%d")

# fors=100

# concurrent=10000
# hour=00

# java -cp /root/workspace/DMP-1.0.3-jar-with-dependencies.jar mobvista.dmp.datasource.ali.AlipayRequestMain ${fors} ${concurrent} ${LOG_TIME} "IMEI_MD5"

if [[ ! -d "/home/hadoop/jiangfan" ]]; then
  mkdir /home/hadoop/jiangfan

  cd /home/hadoop/jiangfan/

  hdfs dfs -get s3://mob-emr-test/wangjf/data/pem/dataplatform_cn.pem .

  chmod 600 dataplatform_cn.pem
fi

fors=1600
concurrent=10000
device_type="IMEI_MD5"
hour="01"

#ssh -o "StrictHostKeyChecking no" -i /home/hadoop/jiangfan/dataplatform_cn.pem -l root 182.92.177.185 "/root/jiangfan/alipay_lahuo_laxin/exec_alipay_request.sh ${fors} ${concurrent} ${LOG_TIME} ${device_type} >/root/jiangfan/alipay_lahuo_laxin/exec_alipay_request.log"
ssh -o "StrictHostKeyChecking no" -i /home/hadoop/jiangfan/dataplatform_cn.pem -l root 182.92.177.185 "/root/jiangfan/alipay_lahuo_laxin/exec_alipay_request.sh ${fors} ${concurrent} ${LOG_TIME} ${device_type} ${hour}"


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

echo "kill java process begin"

sleep 200

shell=" -cp /root/jiangfan/alipay_lahuo_laxin/DMP-1.0.3-jar-with-dependencies.jar mobvista.dmp.datasource.ali.AlipayRequestMain ${fors} ${concurrent} ${LOG_TIME} ${device_type} ${hour}"

ssh -o "StrictHostKeyChecking no" -i /home/hadoop/jiangfan/dataplatform_cn.pem -l root 182.92.177.185 "sh -x /root/jiangfan/alipay_lahuo_laxin/check_process.sh '${shell}'"

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