From 2b03bc83a40e470c977564195f6dcc2c208710d1 Mon Sep 17 00:00:00 2001 From: Alexander Reelsen Date: Fri, 23 Aug 2013 12:34:19 +0200 Subject: [PATCH] Dont write pidfile twice on startup There is no need to write the pidfile in the bin/elasticsearchshell script as this happens already in the java code. Also cleaning up the bin/elasticsearch shell script a bit (no need to return an error code when exec is called, as this forks and exits the shell script immediately). Closes #3529 Closes #1745 --- bin/elasticsearch | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/bin/elasticsearch b/bin/elasticsearch index 5db2355add0..de071cca389 100755 --- a/bin/elasticsearch +++ b/bin/elasticsearch @@ -126,16 +126,14 @@ launch_service() es_parms="$es_parms -Des.foreground=yes" exec "$JAVA" $JAVA_OPTS $ES_JAVA_OPTS $es_parms -Des.path.home="$ES_HOME" -cp "$ES_CLASSPATH" $props \ org.elasticsearch.bootstrap.ElasticSearch - execval=$? + # exec without running it in the background, makes it replace this shell, we'll never get here... + # no need to return something else # Startup ElasticSearch, background it, and write the pid. exec "$JAVA" $JAVA_OPTS $ES_JAVA_OPTS $es_parms -Des.path.home="$ES_HOME" -cp "$ES_CLASSPATH" $props \ org.elasticsearch.bootstrap.ElasticSearch <&- & - execval=$? - [ ! -z "$pidpath" ] && printf '%d' $! > "$pidpath" + return $? fi - - return $execval } # Parse any command line options.