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

elk相关启动脚本-shell编写的更多相关文章

  1. (转)mysql5.6.7多实例安装、配置的详细讲解分析及shell启动脚本的编写

    一.mysql安装 1.下载mysql数据库源码包: wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.27.tar.gz 2.安装mys ...

  2. 微服务一键启动脚本shell没有环境变量的

    #!/bin/bash#######################################################export JAVA_HOME=/root/data/app/jd ...

  3. 微服务一键启动脚本shell带有环境变量的

    etting####################################################### #程序代码数组APPS=(cAssistantbussiness cAssi ...

  4. jar启动脚本shell

    #!/bin/bash#这里可替换为你自己的执行程序,其他代码无需更改 APP_NAME=/opt/server/msp/health-api/health-2.0.2.jar#使用说明,用来提示输入 ...

  5. linux shell 之尝试编写 企业级 启动脚本

    企业Shell面试题10:开发企业级MySQL启动脚本 说明: MySQL启动命令为: 1 /bin/sh mysqld_safe --pid-file=$mysqld_pid_file_path 2 ...

  6. nginx的编译安装以及启动脚本编写

    Nginx的编译安装和启动脚本的编写 Nginxd的功能强大,可以实现代理.负载均衡等企业常用的功能.下面介绍一下nginx的编译安装方法: 1. 下载 官方下载地址:http://nginx.org ...

  7. shell编写redis启动脚本

    ​ 安装后redis,默认系统不会自启动,如果关机或重启redis不会自行启动,linux下/etc/init.d/目录下基本上存放所有系统的大多数的启动脚本,放在这个目录下的脚本可以实现自启动操作. ...

  8. 自己编写服务启动脚本(一):functions文件详细分析和说明

    本文目录: 1.几个显示函数2.action函数3.is_true和is_false函数4.confirm函数5.pid检测相关函数 5.1 checkpid.__pids_var_run和__pid ...

  9. Linux shell编写脚本部署pxe网络装机

    Linux shell编写脚本部署pxe网络装机 人工安装配置,Linux PXE无人值守网络装机  https://www.cnblogs.com/yuzly/p/10582254.html 脚本实 ...

随机推荐

  1. maven推送本地包到私服

    前置要求:配置正确的settings.xml maven 推送 本地jar 到私服的命令示例: mvn deploy:deploy-file -DgroupId=com.oracle -Dartifa ...

  2. 【HDOJ6656】Kejin Player(期望DP)

    题意:玩一个共有n级的游戏,i级出发每次可以花a[i]的代价,有p[i]的几率变成i+1级,有1-p[i]的几率变成x[i]级,x[i]<=i 多次询问,每次询问从l级升到r级的期望总代价 n, ...

  3. CodeForces - Path Queries (并查集+离线查询)

    题目:https://vjudge.net/contest/323699#problem/A 题意:给你一棵树,然后有m个查询,每次查询问一条路径最大边小于给定查询的数量 思路:首先我们看到,我们其实 ...

  4. git commit --amend用法(摘抄)

    适用场景: 比方说,你的代码已经提交到git库,leader审核的时候发现有个Java文件代码有点问题,于是让你修改,通常有2种方法: 方法1:leader 将你提交的所有代码 abandon掉,然后 ...

  5. laravel5.6操作数据curd写法(查询构建器)

    laravel5.6 数据库操作-查询构建器 <?php //laravel5.6 语法 demo示例 namespace App\Http\Controllers;//命名该控制App空间下名 ...

  6. (转)jupyter常用快捷键

    转:http://www.mamicode.com/info-detail-2395285.html Jupyter Notebook 有两种键盘输入模式.即命令模式和编辑模式,这与 vim有些类似. ...

  7. p4463 [国家集训队] calc

    分析 代码 #include<bits/stdc++.h> using namespace std; ][],Ans; inline int pw(int x,int p){ ; whil ...

  8. day24—JavaScript实现导航栏底部引线跟随移动

    转行学开发,代码100天——2018-04-09 前面的学习笔记中记录过,利用:before和:after实现导航栏鼠标移动跟随效果,今天通过JavaScript代码实现同样的效果,以作对比. < ...

  9. day14—jQuery UI 之dialog部件

    转行学开发,代码100天——2018-03-30 今天主要展示jQuery UI 之dialog部件的用法, 参考文档:https://jqueryui.com/dialog/ 本文记录分享初始的引用 ...

  10. Linux_Bash常用脚本

    目录 目录 从用户列表中过滤用户名并创建用户 awktrcut 指令的文本处理 tr指令 cut指令 awk指令 备份文件 测试LFTPServer权限设定 开启Httpd 安装Httpd 批量创建用 ...