You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by th...@apache.org on 2015/11/25 20:30:32 UTC

svn commit: r1716518 - in /lucene/dev/branches/lucene_solr_5_4: ./ solr/ solr/CHANGES.txt solr/bin/ solr/bin/solr

Author: thelabdude
Date: Wed Nov 25 19:30:32 2015
New Revision: 1716518

URL: http://svn.apache.org/viewvc?rev=1716518&view=rev
Log:
SOLR-7169: bin/solr status should return exit code 3 no Solr is running instead of 0

Modified:
    lucene/dev/branches/lucene_solr_5_4/   (props changed)
    lucene/dev/branches/lucene_solr_5_4/solr/   (props changed)
    lucene/dev/branches/lucene_solr_5_4/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/lucene_solr_5_4/solr/bin/   (props changed)
    lucene/dev/branches/lucene_solr_5_4/solr/bin/solr

Modified: lucene/dev/branches/lucene_solr_5_4/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_4/solr/CHANGES.txt?rev=1716518&r1=1716517&r2=1716518&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_4/solr/CHANGES.txt (original)
+++ lucene/dev/branches/lucene_solr_5_4/solr/CHANGES.txt Wed Nov 25 19:30:32 2015
@@ -269,6 +269,9 @@ Bug Fixes
 * SOLR-8073: Solr fails to start on Windows with obscure errors when using relative path.
   (Alexandre Rafalovitch, Ishan Chattopadhyaya via shalin)
 
+* SOLR-7169: bin/solr status should return exit code 3, not 0 if Solr is not running 
+  (Dominik Siebel via Timothy Potter)
+
 Optimizations
 ----------------------
 

Modified: lucene/dev/branches/lucene_solr_5_4/solr/bin/solr
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_4/solr/bin/solr?rev=1716518&r1=1716517&r2=1716518&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_4/solr/bin/solr (original)
+++ lucene/dev/branches/lucene_solr_5_4/solr/bin/solr Wed Nov 25 19:30:32 2015
@@ -423,42 +423,49 @@ function run_tool() {
 
 # get information about any Solr nodes running on this host
 function get_info() {
+  CODE=4
   # first, see if Solr is running
   numSolrs=`find "$SOLR_PID_DIR" -name "solr-*.pid" -type f | wc -l | tr -d ' '`
   if [ "$numSolrs" != "0" ]; then
     echo -e "\nFound $numSolrs Solr nodes: "
-    find "$SOLR_PID_DIR" -name "solr-*.pid" -type f | while read PIDF
+    while read PIDF
       do
         ID=`cat "$PIDF"`
         port=`jetty_port "$ID"`
         if [ "$port" != "" ]; then
           echo -e "\nSolr process $ID running on port $port"
           run_tool status -solr "$SOLR_URL_SCHEME://$SOLR_TOOL_HOST:$port/solr"
+          CODE=$?
           echo ""
         else
           echo -e "\nSolr process $ID from $PIDF not found."
+          CODE=1
         fi
-    done
+    done < <(find "$SOLR_PID_DIR" -name "solr-*.pid" -type f)
   else
     # no pid files but check using ps just to be sure
     numSolrs=`ps auxww | grep start\.jar | grep solr.solr.home | grep -v grep | wc -l | sed -e 's/^[ \t]*//'`
     if [ "$numSolrs" != "0" ]; then
       echo -e "\nFound $numSolrs Solr nodes: "
-      for ID in `ps auxww | grep start\.jar | grep solr.solr.home | grep -v grep | awk '{print $2}' | sort -r`
+      PROCESSES=$(ps auxww | grep start\.jar | grep solr.solr.home | grep -v grep | awk '{print $2}' | sort -r)
+      for ID in $PROCESSES
         do
           port=`jetty_port "$ID"`
           if [ "$port" != "" ]; then
             echo ""
             echo "Solr process $ID running on port $port"
             run_tool status -solr "$SOLR_URL_SCHEME://$SOLR_TOOL_HOST:$port/solr"
+            CODE=$?
             echo ""
           fi
       done
     else
       echo -e "\nNo Solr nodes are running.\n"
+      CODE=3
     fi
   fi
-  
+
+  return $CODE
 } # end get_info
 
 # tries to gracefully stop Solr using the Jetty 
@@ -506,7 +513,7 @@ if [ $# -eq 1 ]; then
     ;;
     -info|-i|status)
         get_info
-        exit
+        exit $?
     ;;
     -version|-v|version)
         run_tool version