在/etc/init.d
目錄下新建文件elasticsearch
java
#!/bin/sh
#chkconfig: 2345 80 05
#description: elasticsearch
export JAVA_HOME=/usr/java/jdk1.8.0_112
export JAVA_BIN=/usr/java/jdk1.8.0_112/bin
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME JAVA_BIN PATH CLASSPATH
case "$1" in
start)
su lyt<<!
cd /home/lyt/dev-repo/elk5/elasticsearch-5.6.9
./bin/elasticsearch -d
!
echo "elasticsearch startup"
;;
stop)
es_pid=`ps aux|grep elasticsearch | grep -v 'grep elasticsearch' | awk '{print $2}'`
kill -9 $es_pid
echo "elasticsearch stopped"
;;
restart)
es_pid=`ps aux|grep elasticsearch | grep -v 'grep elasticsearch' | awk '{print $2}'`
kill -9 $es_pid
echo "elasticsearch stopped"
su lyt<<!
cd /home/lyt/dev-repo/elk5/elasticsearch-5.6.9
./bin/elasticsearch -d
!
echo "elasticsearch startup"
;;
*)
echo "start|stop|restart"
;;
esac
exit $?
保存退出,賦予執行權限nginx
chmod +x elasticsearch
添加到開機啓動任務bash
chkconfig -add elasticsearch
若是不設置開機啓動的話,也能夠使用service elasticsearch start/stop/restart
來操做elasticsearch
在/etc/init.d
目錄下新建文件elasticsearch
ui
保存退出,賦予執行權限spa
chmod +x elasticsearch
添加到開機啓動任務.net
chkconfig -add elasticsearch
若是不設置開機啓動的話,也能夠使用service elasticsearch start/stop/restart
來操做3d
原文:https://my.oschina.net/liuyuantao/blog/1798724rest