ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Linux Shell脚本时间调度

Linux Shell脚本时间调度

原创 Linux操作系统 作者:superjack2 时间:2020-12-28 14:55:26 0 删除 编辑

#!/bin/bash


path=`head -1 input1.txt`

dd=""

path2=""

#获取小时

aa=`echo $path | cut -d \/ -f 6`

#获取年月日

aa2=`echo $path | cut -d \/ -f 5`

cc=$((aa))

if [ $cc -lt 9 ]; then

    bb=$((cc+1))

    dd="0$bb"

    path2="/data/dpi/test/$aa2/$dd"

    echo $path2 > input2.txt

elif [ $cc -eq 9 ]; then

    bb=$((cc+1))

    dd="$bb"

    path2="/data/dpi/test/$aa2/$dd"

    echo $path2 > input2.txt

elif [ $cc -ge 10 ]&&[ $cc -lt 23 ]; then

    bb=$((cc+1))

    dd=$bb

    path2="/data/dpi/test/$aa2/$dd"

    echo $path2 > input2.txt

else

    aa2=`date -d "$aa2 1 days" +"%Y%m%d"`    

    path2="/data/dpi/test/$aa2/00"

    echo $path2 > input2.txt


fi


a=$(hadoop fs -count $path2  | awk '{print $2}')


if [ $a -gt 0 ]; then 

   spark-submit --class com.spark.DataClear --master yarn-client  --executor-memory 8g --num-executors 8 --executor-cores 2 /home/haduser/study05-1.0-SNAPSHOT.jar $path /dataclear/$aa2/$aa

   hadoop fs -mkdir -p /complete/$aa2/$aa

   echo "/dataclear/$aa2/$aa" > "/home/haduser/timetest/$aa2.$aa.ok"

   path3=`head -1 input2.txt`

   echo $path3 > input1.txt

fi


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31537832/viewspace-2745915/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: 没有了~
请登录后发表评论 登录
全部评论
了解技术的深度,才能知道技术的广度!

注册时间:2018-05-18

  • 博文量
    25
  • 访问量
    24812