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
  • 相关阅读:
    程序打包
    MFC AfxMessageBox默认标题修改
    Json
    agsXMPP
    xmpp
    afxcomctl32.h与afxcomctl32.inl报错
    jQuery使用
    EChart使用
    C++ tinyXML使用
    electron之Windows下使用 html js css 开发桌面应用程序
  • 原文地址:https://www.cnblogs.com/dengcongcong/p/10992294.html
Copyright © 2011-2022 走看看