#!/bin/bash

#构建Elasticsearch启动脚本 start_es.sh。
#su:登录用户。
#elastic:部署Elasticsearch用户,避免root用户而无法启动。
#c:c参数后跟具体命令。
#d:Elasticsearch作为守护线程后台启动。
#p:指定线程ID文件,需要新建。

export ES_HOME=/opt/elasticsearch/
su es -c "sh ${ES_HOME}/bin/elasticsearch -d -p ${ES_HOME}/pid"

#!/bin/bash

#构建Elasticsearch停止脚本 stop_es.sh。
#su:登录用户。
#elastic:部署Elasticsearch用户,避免root用户而无法启动。
#c:c参数后跟具体命令。
#d:Elasticsearch作为守护线程后台启动。
#p:指定线程ID文件,需要新建。

export ES_HOME=/opt/elasticsearch/
kill `cat ${ES_HOME}/pid`

Comments are closed.

Post Navigation