Flume定时启动任务 防止挂掉

一,查看Flume条数:ps -ef|grep java|grep flume|wc -l       ==》15

检查进程:给sh脚本添加权限,chmod 777 xx.sh

#!/bin/sh
is_Engine_exist=$(ps -ef|grep java|grep flume|wc -l)
 
if [ $is_Engine_exist -ne 15 ];then
 
        echo 'flumeis down' 
       
cd /usr/hadoop/flume/flume-server
        nohup bin/flume-ng agent -c conf/ -f /usr/hadoop/flume/spooldircsv1.conf -n a1 -Dflume.root.logger=WARN,console >>./local/run.log 2>&1 &
 
else
 
        strDate=`date +%Y%m%d%H%M%S`
 
        strRun="running ${strDate}"
 
fi

 

posted @ 2018-11-15 15:31  Bread_Wang  阅读(1417)  评论(0编辑  收藏  举报