Chinaunix首页 | 论坛 | 博客
  • 博客访问: 349671
  • 博文数量: 54
  • 博客积分: 497
  • 博客等级: 下士
  • 技术积分: 612
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-16 20:05
个人简介

行动…Don\'t ever let somebody tell you, you can\'t do something. you got a dream, you gotta protect it. people can\'t do something themselves they wanna tell you you can\'t do it.if you want something. go get it.

文章分类

全部博文(54)

文章存档

2021年(3)

2018年(1)

2017年(18)

2016年(7)

2015年(4)

2013年(1)

2011年(20)

我的朋友

分类: 大数据

2016-07-26 14:34:03

#!/bin/bash
var1=$1       (备注:传递位置变量20160726)
var2=$2    (备注:传递位置变量20160730
date1=${var1:0:4}"-"${var1:4:2}"-"${var1:6:2}" 00:00:00"   (备注:调用变量,转变为字符串
date2=${var2:0:4}"-"${var2:4:2}"-"${var2:6:2}" 00:00:00"
time1=`date -d "$date1" +%s`    (备注:把字符串转换为时间戳
time2=`date -d "$date2" +%s`
while [ $time1 -le $time2 ]      (备注:对时间戳进行比较)
do
date=`date -d @$time1 "+%Y%m%d"`  (备注:调用变量,把时间戳变为字符串)
Date=`date -d @$time1 "+%Y-%m-%d"`
time3=`expr $time1 - 86400`   (备注:减去一天时间)
DATE_1=`date -d @$time3 "+%Y%m%d"`

Path=/home/hadoop/hoch/data/beijing
if [ -f $Path/gehua/$Date ];then
 cp $Path/gehua/$date.tar.bz2 $Path/gh
tar -jxv -C $Path/gh -f $Path/gh/$date.tar.bz2 $date/ipanel/ars*
cd $Path/gh/$date
ls $Path/gh/$date/ipanel/ars*/$Date.zip | xargs -n1 unzip 
cat $Path/gh/$date/$Date/*>>$Path/gh/${date}ars.txt
hadoop fs -mkdir /source/110000/$date
hadoop fs -put $Path/gh/${date}ars.txt /source/110000/$date


##shuffle
spark-submit --class com.starv.spark.format.live.BJGeHuaFormat   ~/data2/jiangmeng/spark-1.0-SNAPSHOT.jar  $Date#$Date  /source/110000/   /business/live/$date


spark-submit --class com.starv.spark.live.asyn.ArriveNum2H1   ~/data2/jiangmeng/spark-1.0-SNAPSHOT.jar  /business/live/$date/  110000 


spark-submit --class com.starv.spark.live.asyn.ArriveNumNewmedia2H   ~/data2/jiangmeng/spark-1.0-SNAPSHOT.jar  /business/live/$date/  110001


spark-submit --class com.starv.spark.live.asyn.ViewTime24H  ~/data2/jiangmeng/spark-1.0-SNAPSHOT.jar  /business/live/$date/   110000


spark-submit --class com.starv.spark.live.asyn.UserNum  ~/data2/jiangmeng/spark-1.0-SNAPSHOT.jar   hdfs:///business/live/ 110000\|110001  $Date 90


spark-submit --class com.starv.spark.live.asyn.IdStatisticNew  ~/data2/jiangmeng/spark-1.0-SNAPSHOT.jar  hdfs:///business/live/$date/ 110000\|110001 /business/view/$DATE_1/110000/IdBefore /business/view/$date/110000/ $Date


else
exit
fi


rm -rf $Path/gh/${date}ars.txt
rm -rf $Path/gehua/$Date
rm -rf $Path/gh/$date
time1=`expr $time1 + 86400`            (备注:每循环一次增加一天)
done

阅读(2001) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~