lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jan...@apache.org
Subject lucene-solr:branch_6x: SOLR-9508: Install script should check existence of tools, and add option to NOT start service
Date Wed, 21 Sep 2016 19:52:11 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x 8502995e3 -> 33874f9ec


SOLR-9508: Install script should check existence of tools, and add option to NOT start service

(cherry picked from commit b894ab2)


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/33874f9e
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/33874f9e
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/33874f9e

Branch: refs/heads/branch_6x
Commit: 33874f9ece1bafc2952f546d22c43998cbd43806
Parents: 8502995
Author: Jan Høydahl <janhoy@apache.org>
Authored: Wed Sep 21 21:49:12 2016 +0200
Committer: Jan Høydahl <janhoy@apache.org>
Committed: Wed Sep 21 21:52:02 2016 +0200

----------------------------------------------------------------------
 solr/CHANGES.txt                 |  3 +++
 solr/bin/install_solr_service.sh | 37 +++++++++++++++++++++++++++++++----
 2 files changed, 36 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/33874f9e/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index c317349..aae3dee 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -119,6 +119,9 @@ Other Changes
 * SOLR-9538: Relocate (BinaryResponse|JSON|Smile)Writer tests to org.apache.solr.response
   which is the package of the classes they test. (Jonny Marks via Christine Poerschke)
 
+* SOLR-9508: Install script install_solr_service.sh now checks existence of tools.
+  New option -n to avoid starting service after installation (janhoy)
+
 ==================  6.2.1 ==================
 
 Bug Fixes

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/33874f9e/solr/bin/install_solr_service.sh
----------------------------------------------------------------------
diff --git a/solr/bin/install_solr_service.sh b/solr/bin/install_solr_service.sh
old mode 100644
new mode 100755
index 3a8fb88..73c0712
--- a/solr/bin/install_solr_service.sh
+++ b/solr/bin/install_solr_service.sh
@@ -27,7 +27,7 @@ print_usage() {
   fi
 
   echo ""
-  echo "Usage: install_solr_service.sh path_to_solr_distribution_archive OPTIONS"
+  echo "Usage: install_solr_service.sh <path_to_solr_distribution_archive> [OPTIONS]"
   echo ""
   echo "  The first argument to the script must be a path to a Solr distribution archive,
such as solr-5.0.0.tgz"
   echo "    (only .tgz or .zip are supported formats for the archive)"
@@ -48,10 +48,17 @@ print_usage() {
   echo ""
   echo "    -f     Upgrade Solr. Overwrite symlink and init script of previous installation."
   echo ""
+  echo "    -n     Do not start Solr service after install, and do not abort on missing Java"
+  echo ""
   echo " NOTE: Must be run as the root user"
   echo ""
 } # end print_usage
 
+print_error() {
+  echo $1
+  exit 1
+}
+
 proc_version=`cat /etc/*-release 2>/dev/null`
 if [[ $? -gt 0 ]]; then
   if [ -f "/proc/version" ]; then
@@ -104,6 +111,7 @@ else
   exit 1
 fi
 
+SOLR_START=true
 if [ $# -gt 1 ]; then
   shift
   while true; do
@@ -152,6 +160,10 @@ if [ $# -gt 1 ]; then
             SOLR_UPGRADE="YES"
             shift 1
         ;;
+        -n)
+            SOLR_START=false
+            shift 1
+        ;;
         -help|-usage)
             print_usage ""
             exit 0
@@ -172,6 +184,19 @@ if [ $# -gt 1 ]; then
   done
 fi
 
+# Test for availability of needed tools
+if [[ $is_tar ]] ; then
+  tar --version &>/dev/null     || print_error "Script requires the 'tar' command"
+else
+  unzip -hh &>/dev/null         || print_error "Script requires the 'unzip' command"
+fi
+if [[ $SOLR_START == "true" ]] ; then
+  service --version &>/dev/null || print_error "Script requires the 'service' command"
+  java -version &>/dev/null     || print_error "Solr requires java, please install
or set JAVA_HOME properly"
+fi
+lsof -h &>/dev/null             || echo "We recommend installing the 'lsof' command
for more stable start/stop of Solr"
+
+
 if [ -z "$SOLR_EXTRACT_DIR" ]; then
   SOLR_EXTRACT_DIR=/opt
 fi
@@ -334,6 +359,10 @@ echo "Service $SOLR_SERVICE installed."
 echo "Customize Solr startup configuration in /etc/default/$SOLR_SERVICE.in.sh"
 
 # start service
-service "$SOLR_SERVICE" start
-sleep 5
-service "$SOLR_SERVICE" status
+if [[ $SOLR_START == "true" ]] ; then
+  service "$SOLR_SERVICE" start
+  sleep 5
+  service "$SOLR_SERVICE" status
+else
+  echo "Not starting Solr service (option -n given). Start manually with 'service $SOLR_SERVICE
start'"
+fi


Mime
View raw message