#!/bin/bash
#chkconfig:2345 20 90
#description: elastic service
#processname: elastic
ROOT_PATH=/es5/install
case "$1" in
start)
;;
stop)
psid=0
checkpid(){
javaps=`jps -l | grep elasticsearch`
if [ -n "$javaps"]; then
psid=`echo $javaps |awk '{print $1}'`
else
psid=0
fi}
checkpid
if [ $psid -ne 0]; then
echo -n "Stopping elasticsearch (pid=$psid)"
kill -9 psid
if[ $? -eq 0 ];then
echo "[OK]"
else
echo "Failed"
fi
checkpid
if [ $psid -ne 0 ]; then
kill -9 $psid
fi
else
echo"elasticsearch is not running"
fi
;;
*)
echo '参数错误'
echo 'service esserver start|stop'
;;
esac
exit 0
}