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 2014/12/02 17:57:07 UTC

svn commit: r1642952 - in /lucene/dev/trunk/solr: CHANGES.txt bin/solr

Author: thelabdude
Date: Tue Dec  2 16:57:06 2014
New Revision: 1642952

URL: http://svn.apache.org/r1642952
Log:
SOLR-6653: should return error code >0 when something fails

Modified:
    lucene/dev/trunk/solr/CHANGES.txt
    lucene/dev/trunk/solr/bin/solr

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1642952&r1=1642951&r2=1642952&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Tue Dec  2 16:57:06 2014
@@ -523,6 +523,9 @@ Other Changes
 * SOLR-6694: Auto-detect JAVA_HOME using the Windows registry if it is not set
   (janhoy, Timothy Potter)
 
+* SOLR-6653: bin/solr script should return error code >0 when something fails
+  (janhoy, Timothy Potter)
+
 ==================  4.10.2 ==================
 
 Bug FixesAnalyticsComponent

Modified: lucene/dev/trunk/solr/bin/solr
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/bin/solr?rev=1642952&r1=1642951&r2=1642952&view=diff
==============================================================================
--- lucene/dev/trunk/solr/bin/solr (original)
+++ lucene/dev/trunk/solr/bin/solr Tue Dec  2 16:57:06 2014
@@ -71,14 +71,7 @@ done
 
 SOLR_TIP=`dirname "$SOLR_SCRIPT"`/..
 SOLR_TIP=`cd "$SOLR_TIP"; pwd`
-
-# TODO: see SOLR-3619, need to support server or example
-# depending on the version of Solr
-if [ -e "$SOLR_TIP/server/start.jar" ]; then
-  DEFAULT_SERVER_DIR=$SOLR_TIP/server
-else
-  DEFAULT_SERVER_DIR=$SOLR_TIP/example
-fi
+DEFAULT_SERVER_DIR=$SOLR_TIP/server
 
 # If an include wasn't specified in the environment, then search for one...
 if [ "x$SOLR_INCLUDE" == "x" ]; then
@@ -190,10 +183,12 @@ function print_usage() {
     echo ""
     echo "  -k <key>      Stop key; default is solrrocks"
     echo ""
-    echo "  -p <port>     Specify the port the Solr HTTP listener is bound to; default is 8983"
+    echo "  -p <port>     Specify the port the Solr HTTP listener is bound to"
     echo ""
     echo "  -all          Find and stop all running Solr servers on this host"
     echo ""
+    echo "  NOTE: To see if any Solr servers are running, do: solr -i"
+    echo ""
   elif [ "$CMD" == "healthcheck" ]; then
     echo ""
     echo "Usage: solr healthcheck [-c collection] [-z zkHost]"
@@ -308,7 +303,7 @@ function get_info() {
         port=`jetty_port "$ID"`
         if [ "$port" != "" ]; then
           echo ""
-          echo "Found Solr process $ID running on port $port"
+          echo "Solr process $ID running on port $port"
           run_tool status -solr http://localhost:$port/solr
           echo ""
        fi
@@ -323,7 +318,7 @@ function get_info() {
           port=`jetty_port "$ID"`
           if [ "$port" != "" ]; then
             echo ""
-            echo "Found Solr process $ID running on port $port"
+            echo "Solr process $ID running on port $port"
             run_tool status -solr http://localhost:$port/solr
             echo ""
           fi
@@ -486,7 +481,7 @@ if [[ "$SCRIPT_CMD" == "create_core" || 
               CREATE_CONFIGSET="$2"
               shift 2
           ;;
-          -shards)
+          -s|-shards)
               if [[ "$2" == "" || "${2:0:1}" == "-" ]]; then
                 print_usage "$SCRIPT_CMD" "Shard count is required when using the $1 option!"
                 exit 1
@@ -494,7 +489,7 @@ if [[ "$SCRIPT_CMD" == "create_core" || 
               CREATE_NUM_SHARDS="$2"
               shift 2
           ;;
-          -replicationFactor)
+          -rf|-replicationFactor)
               if [[ "$2" == "" || "${2:0:1}" == "-" ]]; then
                 print_usage "$SCRIPT_CMD" "Replication factor is required when using the $1 option!"
                 exit 1
@@ -591,12 +586,18 @@ if [ $# -gt 0 ]; then
               exit 1
             fi
 
-            # see if the arg value is relative to the tip vs full path
-            if [[ $2 != /* ]] && [[ -d "$SOLR_TIP/$2" ]]; then
-              SOLR_SERVER_DIR="$SOLR_TIP/$2"
+            if [[ "$2" == "." || "$2" == "./" || "$2" == ".." || "$2" == "../" ]]; then
+              SOLR_SERVER_DIR=`pwd`/$2
             else
-              SOLR_SERVER_DIR="$2"
+              # see if the arg value is relative to the tip vs full path
+              if [[ $2 != /* ]] && [[ -d "$SOLR_TIP/$2" ]]; then
+                SOLR_SERVER_DIR="$SOLR_TIP/$2"
+              else
+                SOLR_SERVER_DIR="$2"
+              fi
             fi
+            # resolve it to an absolute path
+            SOLR_SERVER_DIR=`cd "$SOLR_SERVER_DIR"; pwd`
             shift 2
         ;;
         -s|-solr.home)
@@ -809,7 +810,7 @@ if [ "$EXAMPLE" != "" ]; then
             shift
         ;;
         techproducts)
-            SOLR_HOME="$SOLR_TIP/server/solr"
+            SOLR_HOME="$SOLR_SERVER_DIR/solr"
             EXAMPLE_CONFIGSET=sample_techproducts_configs
             shift
         ;;
@@ -818,7 +819,7 @@ if [ "$EXAMPLE" != "" ]; then
             shift
         ;;
         schemaless)
-            SOLR_HOME="$SOLR_TIP/server/solr"
+            SOLR_HOME="$SOLR_SERVER_DIR/solr"
             EXAMPLE_CONFIGSET=data_driven_schema_configs
             shift
         ;;
@@ -829,6 +830,11 @@ if [ "$EXAMPLE" != "" ]; then
     esac
 fi
 
+if [[ "$FG" == "true" && "$EXAMPLE" != "" ]]; then
+  FG="false"
+  echo -e "\nWARNING: Foreground mode (-f) not supported when running examples.\n"
+fi
+
 if [ "$STOP_KEY" == "" ]; then
   STOP_KEY="solrrocks"
 fi
@@ -876,7 +882,7 @@ if [[ "$SCRIPT_CMD" == "start" ]]; then
 
   if [ "$SOLR_PID" != "" ]; then
     echo -e "\nPort $SOLR_PORT is already being used by another process (pid: $SOLR_PID)\n"
-    exit
+    exit 1
   fi
 else
   # either stop or restart
@@ -890,6 +896,7 @@ else
     stop_solr "$SOLR_SERVER_DIR" "$SOLR_PORT" "$STOP_KEY" "$SOLR_PID"
   else
     echo -e "No process found for Solr node running on port $SOLR_PORT"
+    exit 1
   fi
 fi