Browse Source

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
Alexander Reelsen 12 years ago
parent
commit
2b03bc83a4
1 changed files with 3 additions and 5 deletions
  1. 3 5
      bin/elasticsearch

+ 3 - 5
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.