You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ep...@apache.org on 2023/05/17 00:09:19 UTC
[solr] branch main updated: SOLR-16798: Remove the bin/solr -f pattern in favour of bin/solr start -f explicit command. (#1644)
This is an automated email from the ASF dual-hosted git repository.
epugh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new 91c93f750c2 SOLR-16798: Remove the bin/solr -f pattern in favour of bin/solr start -f explicit command. (#1644)
91c93f750c2 is described below
commit 91c93f750c2c7330e1a888bc94bb7e0573cce594
Author: bszabo97 <79...@users.noreply.github.com>
AuthorDate: Wed May 17 02:09:13 2023 +0200
SOLR-16798: Remove the bin/solr -f pattern in favour of bin/solr start -f explicit command. (#1644)
Co-authored-by: Eric Pugh <ep...@opensourceconnections.com>
---
solr/CHANGES.txt | 2 ++
solr/bin/solr | 21 ++++++++++++---------
solr/core/src/java/org/apache/solr/cli/SolrCLI.java | 7 +++++--
3 files changed, 19 insertions(+), 11 deletions(-)
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);
}