ELK的启动脚本
Posted dengcongcong
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ELK的启动脚本相关的知识,希望对你有一定的参考价值。
作者:邓聪聪
方便自己的应用,制作一个elk的自启动脚本
#!/bin/sh PATH=$PATH . /etc/init.d/functions start() if [ `whoami` == elk ];then action "start elasticsearch:" false
echo "please use user elk started"
else su - elk -c "/elk/elasticsearch-6.3.0/bin/elasticsearch -d" action "start elasticsearch:" true touch /var/lock/subsys/elasticsearch fi; stop() if [ $UID -ne 0 ];then action "start elasticsearch:" false else ps_uid=`ps aux|grep elasticsearch | grep -v grep | awk ‘print $2‘` kill -9 $ps_uid rm -f /var/lock/subsys/elasticsearch action "start elasticsearch:" true fi; restart() stop start case "$1" in start) start ;; stop) stop ;; restart) stop start ;; *) echo "use user elk path=/elk/elasticsearch-6.3.0/bin/elasticsearch started" esac
以上是关于ELK的启动脚本的主要内容,如果未能解决你的问题,请参考以下文章