zoukankan      html  css  js  c++  java
  • ELK的启动脚本

    作者:邓聪聪

    方便自己的应用,制作一个elk的自启动脚本

    #!/bin/sh
    PATH=$PATH
    . /etc/init.d/functions
    
    start() {
        if [ `ps aux|grep elasticsearch | grep -v grep|wc -l` -eq 0 ];then
            if [ `whoami` == elk ];then
              /elk/elasticsearch-6.3.0/bin/elasticsearch -d
              action "start elasticsearch:" true
            else
              su - elk -c "/elk/elasticsearch-6.3.0/bin/elasticsearch -d"
              if [ $? -eq 0 ];then
                 touch /var/lock/subsys/elasticsearch
                 action "start elasticsearch:" true
              else
                 action "start elasticsearch:" false
              fi
            fi
        else
            echo "elasticsearch is running"
        fi
    }
    stop() {
        if [ `ps aux|grep elasticsearch | grep -v grep|wc -l` -eq 0 ];then 
            echo "No running program found elasticsearch"
        else
            ps_uid=`ps aux|grep elasticsearch | grep -v grep | awk '{print $2}'`
            kill -9 $ps_uid
            [ $? -eq 0 ] && rm -f /var/lock/subsys/elasticsearch
            action "elasticsearch is stop" true
        fi
    }
    restart() {
        stop
        start
    }
    case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart)
        stop
        start
        ;;
    *)
        echo $"Use $0 start|stop|restart"
    esac
  • 相关阅读:
    jQuery让渡$操作符
    JSON
    Jquery实现Ajax(二)
    Jquery实现Ajax(一)
    Javascript实现Ajax
    文章目录
    读过的书
    JVM笔记(5)-垃圾回收&内存分配策略
    JVM笔记(4)-对象及其引用
    JVM笔记(3)-内存结构&方法执行(栈帧)
  • 原文地址:https://www.cnblogs.com/dengcongcong/p/10992294.html
Copyright © 2011-2022 走看看