Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-16798: Remove the bin/solr -f pattern in favour of bin/solr start -f explicit command. (#1644)

bszabo9791c93f750c2c
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index de6a37d29ba..74daffedb05 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -46,6 +46,8 @@ Other Changes
* PR#1629: Fix typos in org.apache.solr.core package (Andrey Bozhko, Marcus Eagan)
+* SOLR-16798: Remove the bin/solr -f pattern in favour of bin/solr start -f explicit command. (Bence Szabo via Eric Pugh)
+
================== 9.3.0 ==================
New Features
diff --git a/solr/bin/solr b/solr/bin/solr
index d903ac6544e..ab11eb86bd2 100644
--- a/solr/bin/solr
+++ b/solr/bin/solr
@@ -949,14 +949,8 @@ if [ $# -eq 1 ]; then
fi
if [ $# -gt 0 ]; then
- # if first arg starts with a dash (and it's not -help or -info),
- # then assume they are starting Solr, such as: solr -f
- if [[ $1 == -* ]]; then
- SCRIPT_CMD="start"
- else
- SCRIPT_CMD="$1"
- shift
- fi
+ SCRIPT_CMD="$1"
+ shift
else
# no args - just show usage and exit
print_usage ""
@@ -1645,12 +1639,21 @@ if [[ "$SCRIPT_CMD" == "auth" ]]; then
exit $?
fi
+if [[ "$SCRIPT_CMD" == "api" ]]; then
+ run_tool api "$@"
+ exit $?
+fi
# verify the command given is supported
if [ "$SCRIPT_CMD" != "stop" ] && [ "$SCRIPT_CMD" != "start" ] && [ "$SCRIPT_CMD" != "restart" ] && [ "$SCRIPT_CMD" != "status" ] && [ "$SCRIPT_CMD" != "assert" ]; then
# handoff this command to the SolrCLI and let it handle the option parsing and validation
run_tool "$SCRIPT_CMD" "$@"
- exit $?
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ print_usage ""
+ exit $ret
+ fi
+ exit 0
fi
#Check current Ulimits for Open Files and Max Processes. Warn if they are below the recommended values.
diff --git a/solr/core/src/java/org/apache/solr/cli/SolrCLI.java b/solr/core/src/java/org/apache/solr/cli/SolrCLI.java
index af95a0711f7..be9b9ad94f4 100755
--- a/solr/core/src/java/org/apache/solr/cli/SolrCLI.java
+++ b/solr/core/src/java/org/apache/solr/cli/SolrCLI.java
@@ -137,9 +137,12 @@ public class SolrCLI implements CLIO {
exit(1);
}
- if (args.length == 1 && Arrays.asList("-v", "-version", "version").contains(args[0])) {
+ if (Arrays.asList("-v", "-version", "version").contains(args[0])) {
// Simple version tool, no need for its own class
- CLIO.out(SolrVersion.LATEST.toString());
+ if (args.length != 1) {
+ CLIO.err("Version tool does not accept any parameters!");
+ }
+ CLIO.out("Solr version is: " + SolrVersion.LATEST.toString());
exit(0);
}