linux脚本(3)——让程序跑完后时间参数+1继续运行

测试完了,不建议使用

前言

在实际工作中,我们可能会遇到一些特定的需求,输出一定时间段的数据,如果手动提交,就要等程序跑完,修改参数继续提交,如此循环,那么怎么写一个脚本解放双手呢?

一、 思路

检测指定程序有几个在运行,当有一个在运行时候不做处理,当没有在运行的时候,时间参数加一,执行脚本

二、脚本代码

Checktest.sh

#!/bin/bash
exec_num=`ps -ef | grep TTest.test.Test01| grep -v grep |wc -l`
if test ${exec_num} -gt 1 ;then
   exit
fi
start_time=$1
aa=$2

for (( i = ${1}; i < ${2}; i++ )); do
        sh /home/rx_yzj/bash/test.sh ${1}
done

test.sh

nohup spark-submit --master yarn --deploy-mode cluster \
        --queue test \
        --driver-memory 4g --executor-memory 40g --num-executors 6 --executor-cores 10 \
        --files "./user.test.keytab" \
        --conf spark.port.maxRetries=128 \
        --conf spark.executor.memoryOverhead=4096 \
        --conf spark.driver.memoryOverhead=1024 \
        --conf spark.driver.maxResultSize=8g \
        --conf spark.shuffle.service.index.cache.size=7196m \
        --conf spark.network.timeout=600s \
        --conf spark.reducer.maxSizeInFlight=144m \
        --conf spark.executor.heartbeatInterval=60s \
        --conf spark.shuffle.file.buffer=3m \
        --conf spark.shuffle.io.maxRetries=6 \
        --conf spark.shuffle.sort.bypassMergeThreshold=400 \
        --conf spark.memory.offHeap.enabled=true \
        --conf spark.memory.offHeap.size=4096 \
        --conf spark.shuffle.unsafe.file.output.buffer=300m \
        --conf spark.unsafe.sorter.spill.reader.buffer.size=300m \
        --conf spark.default.parallelism=120 \
        --conf "spark.executor.extraJavaOptions=-XX:ParallelGCThreads=5 -XX:+UseParallelGC -XX:+UseAdaptiveSizePolicy -XX:NewRatio=4" \
        --class TTest.test.Test01 \
      /home/rx_yzj/jars/test.jar \
      $1\
      > /home/rx_yzj/logs/test 2>&1 &

设置定时任务,此处设置程序从4号跑到6号

crontab -e
*/1 * * * * /bin/bash /home/rx_yzj/bash/Checktest.sh 20220804 20220806
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值