ubuntu es 添加开机启动

#!/bin/bash
path="/disk2/es"

case "$1" in
start)
su cheng<<!
cd $path
./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 cheng<<!
cd $path
./bin/elasticsearch -d
!
echo "elasticsearch startup"
;;
*)
echo "start|stop|restart"
;;
esac

exit $?

 

posted @ 2020-04-29 18:25  酷酷的城池  阅读(361)  评论(0编辑  收藏  举报