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/01/22 20:19:22 UTC

svn commit: r1654019 - in /lucene/dev/branches/lucene_solr_5_0: ./ solr/ solr/CHANGES.txt solr/bin/ solr/bin/solr

Author: thelabdude
Date: Thu Jan 22 19:19:21 2015
New Revision: 1654019

URL: http://svn.apache.org/r1654019
Log:
SOLR-7018: bin/solr stop should stop if there is only one node running or generate an error message prompting the user to be explicit about which of multiple nodes to stop using the -p or -all options

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

Modified: lucene/dev/branches/lucene_solr_5_0/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/solr/CHANGES.txt?rev=1654019&r1=1654018&r2=1654019&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_0/solr/CHANGES.txt (original)
+++ lucene/dev/branches/lucene_solr_5_0/solr/CHANGES.txt Thu Jan 22 19:19:21 2015
@@ -722,6 +722,10 @@ Other Changes
 * SOLR-6521: CloudSolrClient should synchronize cache cluster state loading
   ( Noble Paul, Jessica Cheng Mallet)
 
+* SOLR-7018: bin/solr stop should stop if there is only one node running or generate
+  an error message prompting the user to be explicit about which of multiple nodes
+  to stop using the -p or -all options (Timothy Potter)
+
 ==================  4.10.3 ==================
 
 Bug Fixes

Modified: lucene/dev/branches/lucene_solr_5_0/solr/bin/solr
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_5_0/solr/bin/solr?rev=1654019&r1=1654018&r2=1654019&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_5_0/solr/bin/solr (original)
+++ lucene/dev/branches/lucene_solr_5_0/solr/bin/solr Thu Jan 22 19:19:21 2015
@@ -1060,8 +1060,10 @@ if [[ "$SCRIPT_CMD" == "stop" && -z "$SO
   else
     # not stopping all and don't have a port, but if we can find the pid file for the default port 8983, then use that
     none_stopped=true
-    if [ -e "$SOLR_PID_DIR/solr-8983.pid" ]; then
-      PID=`cat $SOLR_PID_DIR/solr-8983.pid`
+    numSolrs=`find $SOLR_PID_DIR -name "solr-*.pid" -type f | wc -l | tr -d ' '`
+    if [ $numSolrs -eq 1 ]; then
+      # only do this if there is only 1 node running, otherwise they must provide the -p or -all
+      PID=`find $SOLR_PID_DIR -name "solr-*.pid" -type f -exec cat {} \;`
       CHECK_PID=`ps auxww | awk '{print $2}' | grep $PID | sort -r | tr -d ' '`
       if [ "$CHECK_PID" != "" ]; then
         port=`jetty_port "$CHECK_PID"`
@@ -1069,11 +1071,15 @@ if [[ "$SCRIPT_CMD" == "stop" && -z "$SO
           stop_solr "$SOLR_SERVER_DIR" "$port" "$STOP_KEY" "$CHECK_PID"
           none_stopped=false
         fi
-        rm -f $SOLR_PID_DIR/solr-8983.pid
       fi
     fi
+
     if $none_stopped; then
-      echo -e "\nMust either specify a port using -p or -all to stop all Solr nodes on this host.\nUse the status command to see if any Solr nodes are running."
+      if [ $numSolrs -gt 0 ]; then
+        echo -e "\nFound $numSolrs Solr nodes running! Must either specify a port using -p or -all to stop all Solr nodes on this host.\n"
+      else
+        echo -e "\nNo Solr nodes found to stop.\n"
+      fi
       exit 1
     fi
   fi