定时 关闭Spark-Submit ,Kafka

 一.spark-submit


vim stopSparksubmit.sh

#! /bin/bash


a=0
while  true 
do


#SparkSubmitid=`/usr/jdk8/bin/jps  | /bin/grep -v grep | /bin/grep SparkSubmit | /usr/bin/cut  -d " " -f 1`
SparkSubmitid=`/usr/jdk8/bin/jps  | /bin/grep -v grep | /bin/grep SparkSubmit | /usr/bin/awk  '{print $1}'`
/bin/kill -9  ${SparkSubmitid}
a=$(($a+1))
/bin/echo  "The  ${a}th process  is done"


sleep 1s


done


二 关闭kafka

vim stopKafka.sh

#! /bin/bash


kafkaconsolePid=`/home/sznongfu/opt/jdk-1.8.0/bin/jps | /bin/grep -v grep | /bin/grep Kafka | /usr/bin/cut  -d " " -f 1`
/bin/kill -9  ${kafkaconsolePid}

#/bin/echo  "is done"


三.定时关闭:crontab, azkaban(基本相同,设置时间)

crontab -e 

 1 0 5 7  *   sh  /tmp/killKafkaConsole.sh

1 0 5 7  *   sh  /tmp/stopSparksubmit.sh

:x  (保存退出)

 
 

你可能感兴趣的:(spark,shell)