Skip to content

Commit

Permalink
fix issue in init to support ES 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jbdamiano committed Feb 11, 2016
1 parent 57b1ac3 commit 05f1381
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions templates/default/elasticsearch.init.erb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ulimit -l <%= node[:elasticsearch][:limits][:memlock] %>

PIDFILE='<%= node.elasticsearch[:pid_file] %>'
ES_INCLUDE='<%= node.elasticsearch[:path][:conf] %>/elasticsearch-env.sh'
CHECK_PID_RUNNING=$(ps ax | grep 'java' | grep -e "es.pidfile=$PIDFILE" | sed 's/^\s*\([0-9]*\)\s.*/\1/')
CHECK_PID_RUNNING=$(ps ax | grep 'java' | grep -e "$PIDFILE" | sed 's/^\s*\([0-9]*\)\s.*/\1/')
RUBY_BIN=""

if command -v ruby >/dev/null 2>&1; then
Expand Down Expand Up @@ -115,7 +115,7 @@ stop() {
restart() {
stop
timeout=30
while ps aux | grep 'java' | grep -e "es.pidfile"; do
while ps aux | grep 'java' | grep -e "$PIDFILE"; do
echo -n '.'
(( timeout-- ))
if [ $timeout -lt '1' ]; then return 1; fi
Expand All @@ -130,7 +130,7 @@ status() {

# RUNNING
if [[ $pid && -d "/proc/$pid" ]]; then
if [ -z "$RUBY_BIN" ]; then
if [ -n "$RUBY_BIN" ]; then
version=$(curl -s 'http://localhost:<%= node.elasticsearch[:http][:port] %>' | $RUBY_BIN -e 'require "json"; print JSON.parse(STDIN.read)["version"]["number"]')
echo -e "\033[1;37;46melasticsearch $version running with PID $pid\033[0m"
else
Expand Down

0 comments on commit 05f1381

Please sign in to comment.