zoukankan      html  css  js  c++  java
  • elk相关启动脚本-shell编写

    elasticsearch-restart

    #!/bin/bash

    PID=`ps -ef|grep elasticsearch|grep -vE 'grep|controller|elasticsearch-restart'|awk '{print $2}'`
    kill -9 $PID >/dev/null 2>&1
    sleep 1
    nohup elasticsearch -d >/data/soft/elasticsearch/nohup.out 2>&1 &
    if [ ! -z $PID ]
    then
    echo SUCCESS!
    fi

    filebeat-restart

    #!/bin/bash

    PID=`ps -ef|grep filebeat|grep -vE 'grep|filebeat-restart'|awk '{print $2}'`
    kill -9 $PID >/dev/null 2>&1
    sleep 1
    nohup filebeat -c /data/soft/filebeat/filebeat.yml >/data/soft/filebeat/nohup.out 2>&1 &
    if [ ! -z $PID ]
    then
    echo SUCCESS!
    fi

    kibana-restart

    #!/bin/bash

    PID=`ps -ef|grep kibana|grep -vE 'grep|kibana-restart'|awk '{print $2}'`
    kill -9 $PID >/dev/null 2>&1
    sleep 1
    nohup /data/soft/kibana/bin/kibana >/data/soft/logstash/out.log 2>&1 &
    if [ ! -z $PID ]
    then
    echo SUCCESS!
    fi

    logstash-control

    #!/bin/bash


    pid_exists(){
    nohup logstash -f /data/soft/logstash/config/logstash.conf >/data/soft/logstash/out.log 2>&1 &
    sleep 1
    PID=`ps -ef|grep logstash|grep -vE 'grep|logstash-control|logstash-plain'|awk '{print $2}'`
    if [ ! -z $PID ]
    then
    echo SUCCESS!
    else
    echo FAILED!
    fi
    }
    pid_not_exists(){
    PID=`ps -ef|grep logstash|grep -vE 'grep|logstash-control|logstash-plain'|awk '{print $2}'`
    if [ ! -z $PID ]
    then
    kill -9 $PID >/dev/null 2>&1
    echo SUCCESS!
    else
    echo "PID has been killed!..."
    fi
    }
    case $1 in
    start)
    echo -n "starting......"
    pid_exists
    ;;
    stop)
    echo -n "stopping......"
    pid_not_exists
    ;;
    *)
    echo "sorry,other opera"
    ;;
    esac

  • 相关阅读:
    C++STL——vector
    大数常用计算模板及例题
    在线算法&离线算法
    线段树——hdu1166敌兵布阵
    C++STL——堆栈
    C++STL——优先队列
    C++STL——队列
    图的建立——图的两种存储结构
    Manacher算法——最长回文子串
    HttpClient的几个实现类
  • 原文地址:https://www.cnblogs.com/immense/p/11402802.html
Copyright © 2011-2022 走看看