Skip to content

Instantly share code, notes, and snippets.

@makuk66
Created September 29, 2015 20:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makuk66/5ba75e8d592bf5428611 to your computer and use it in GitHub Desktop.
Save makuk66/5ba75e8d592bf5428611 to your computer and use it in GitHub Desktop.
mak@crab 516 solr-5.3.0 $ diff -du bin/solr.orig bin/solr
--- bin/solr.orig 2015-09-29 21:41:32.000000000 +0100
+++ bin/solr 2015-09-29 21:41:48.000000000 +0100
@@ -1304,7 +1304,7 @@
if [ "$run_in_foreground" == "true" ]; then
echo -e "\nStarting Solr$IN_CLOUD_MODE on port $SOLR_PORT from $SOLR_SERVER_DIR\n"
- "$JAVA" "${SOLR_START_OPTS[@]}" $SOLR_ADDL_ARGS -jar start.jar "${SOLR_JETTY_CONFIG[@]}"
+ exec "$JAVA" "${SOLR_START_OPTS[@]}" $SOLR_ADDL_ARGS -jar start.jar "${SOLR_JETTY_CONFIG[@]}"
else
# run Solr in the background
nohup "$JAVA" "${SOLR_START_OPTS[@]}" $SOLR_ADDL_ARGS -jar start.jar \
@makuk66
Copy link
Author

makuk66 commented Sep 29, 2015

When you run bin/solr -f, bash invokes java as a sub-process. If you kill -TERM the script, java gets terminated uncleanly. By using exec, when you send a TERM, it stops ServerConnector and shuts down the core. And you save yourself a process.

@makuk66
Copy link
Author

makuk66 commented Sep 29, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment