Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Feb 2018 14:13:30 +0000 (UTC)
From:      Mark Felder <feld@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r462590 - in head/textproc/elasticsearch5: . files
Message-ID:  <201802221413.w1MEDUdt024499@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: feld
Date: Thu Feb 22 14:13:30 2018
New Revision: 462590
URL: https://svnweb.freebsd.org/changeset/ports/462590

Log:
  textproc/elasticsearch5: rc script improvement
  
  - Fix behavior with multiple profiles
  - Correctly handle the individual config dirs
  - Prevent thundering herd at shutdown by using wait_for_pids
  
  Approved by:	maintainer
  MFH:		2018Q1

Deleted:
  head/textproc/elasticsearch5/files/patch-bin_elasticsearch.in.sh
Modified:
  head/textproc/elasticsearch5/Makefile
  head/textproc/elasticsearch5/files/elasticsearch.in

Modified: head/textproc/elasticsearch5/Makefile
==============================================================================
--- head/textproc/elasticsearch5/Makefile	Thu Feb 22 14:06:51 2018	(r462589)
+++ head/textproc/elasticsearch5/Makefile	Thu Feb 22 14:13:30 2018	(r462590)
@@ -3,7 +3,7 @@
 
 PORTNAME=	elasticsearch
 PORTVERSION=	5.3.0
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	textproc java devel
 MASTER_SITES=	https://artifacts.elastic.co/downloads/${PORTNAME}/ \
 		http://mirrors.rit.edu/zi/

Modified: head/textproc/elasticsearch5/files/elasticsearch.in
==============================================================================
--- head/textproc/elasticsearch5/files/elasticsearch.in	Thu Feb 22 14:06:51 2018	(r462589)
+++ head/textproc/elasticsearch5/files/elasticsearch.in	Thu Feb 22 14:13:30 2018	(r462590)
@@ -15,7 +15,7 @@
 #               Set it to required username.
 # elasticsearch_group (group):   Set to elasticsearch by default.
 #               Set it to required group.
-# elasticsearch_config (path):   Set to /usr/local/etc/elasticsearch/elasticsearch.yml by default.
+# elasticsearch_config (path):   Set to %%PREFIX%%/etc/elasticsearch/elasticsearch.yml by default.
 #               Set it to the config file location.
 # elasticsearch_tmp (path):  Set to /var/tmp/elasticsearch by default.
 #		Set it to the path to be used for temp files.
@@ -27,31 +27,30 @@ rcvar=elasticsearch_enable
 
 load_rc_config ${name}
 
-: ${elasticsearch_enable:="NO"}
-: ${elasticsearch_user:=%%SEARCHUSER%%}
-: ${elasticsearch_group:=%%SEARCHGROUP%%}
-: ${elasticsearch_config:="%%PREFIX%%/etc/elasticsearch"}
-: ${elasticsearch_tmp:="/var/tmp/elasticsearch"}
+: ${elasticsearch_enable:=NO}
+: ${elasticsearch_user=elasticsearch}
+: ${elasticsearch_group=elasticsearch}
+: ${elasticsearch_config=%%PREFIX%%/etc/elasticsearch}
+: ${elasticsearch_tmp=/var/tmp/elasticsearch}
 
 required_files="${elasticsearch_config}/elasticsearch.yml"
-_pidprefix="/var/run/elasticsearch"
-pidfile="${_pidprefix}.pid"
+_pidprefix=/var/run/elasticsearch
+pidfile=${_pidprefix}.pid
 
 extra_commands="console status"
-console_cmd="elasticsearch_console"
-start_precmd="elasticsearch_precmd"
-status_cmd="elasticsearch_status"
-stop_cmd="elasticsearch_stop"
-command="%%PREFIX%%/lib/elasticsearch/bin/elasticsearch"
-command_args="-d --pidfile=${pidfile}"
+console_cmd=elasticsearch_console
+start_precmd=elasticsearch_precmd
+status_cmd=elasticsearch_status
+stop_cmd=elasticsearch_stop
+command=%%PREFIX%%/lib/elasticsearch/bin/elasticsearch
+command_args="-d --pidfile=${pidfile} -Epath.conf=${elasticsearch_config}"
 
 elasticsearch_precmd()
 {
-    touch ${pidfile}
-    chown ${elasticsearch_user}:${elasticsearch_group} ${pidfile}
-    /usr/bin/install -d -o ${elasticsearch_user} -g ${elasticsearch_group} -m 750 ${elasticsearch_tmp}
-    /usr/bin/install -d -o ${elasticsearch_user} -g ${elasticsearch_group} -m 750 /var/db/elasticsearch
-    /usr/bin/install -d -o ${elasticsearch_user} -g ${elasticsearch_group} -m 750 /var/log/elasticsearch
+    /usr/bin/install -o ${elasticsearch_user} -g ${elasticsearch_group} /dev/null ${pidfile}
+    /usr/bin/install -d -o ${elasticsearch_user} -g ${elasticsearch_group} -m 755 ${elasticsearch_tmp}
+    /usr/bin/install -d -o ${elasticsearch_user} -g ${elasticsearch_group} -m 755 /var/db/elasticsearch
+    /usr/bin/install -d -o ${elasticsearch_user} -g ${elasticsearch_group} -m 755 /var/log/elasticsearch
 }
 
 elasticsearch_console()
@@ -60,7 +59,6 @@ elasticsearch_console()
     run_rc_command "start"
 }
 
-
 elasticsearch_stop()
 {
     rc_pid=$(elasticsearch_check_pidfile $pidfile)
@@ -72,7 +70,8 @@ elasticsearch_stop()
     fi
 
     echo "Stopping ${name}."
-    kill ${rc_pid} 2> /dev/null
+    kill $sig_stop ${rc_pid}
+    wait_for_pids ${rc_pid}
 }
 
 elasticsearch_status()
@@ -102,15 +101,13 @@ elasticsearch_check_pidfile()
         debug "pid file ($_pidfile): no pid in file."
         return
     fi
-    if [ -n "`%%LOCALBASE%%/bin/jps -l | grep -e "^$_pid"`" ]; then
+    if [ -n "`%%PREFIX%%/bin/jps -l | grep -e "^$_pid"`" ]; then
         echo -n $_pid
     fi
 }
 if [ -n "$2" ]; then
     profile="$2"
     if [ "x${elasticsearch_profiles}" != "x" ]; then
-        pidfile="${_pidprefix}.${profile}.pid"
-	command_args="-d --pidfile=${pidfile}"
         eval elasticsearch_config="\${elasticsearch_${profile}_config:-}"
         if [ "x${elasticsearch_config}" = "x" ]; then
             echo "You must define a configuration  (elasticsearch_${profile}_config)"
@@ -120,6 +117,11 @@ if [ -n "$2" ]; then
         required_files="${elasticsearch_config}/jvm.options"
         eval elasticsearch_enable="\${elasticsearch_${profile}_enable:-${elasticsearch_enable}}"
         eval elasticsearch_tmp="\${elasticsearch_${profile}_args:-${elasticsearch_tmp}}"
+        pidfile="${_pidprefix}.${profile}.pid"
+	if [ -e ${elasticsearch_config}/jvm.options ]; then
+		export ES_JVM_OPTIONS=${elasticsearch_config}/jvm.options
+	fi
+	command_args="-d --pidfile=${pidfile} -Epath.conf=${elasticsearch_config}"
     else
         echo "$0: extra argument ignored"
     fi
@@ -147,7 +149,7 @@ else
                 ;;
             esac
             echo "===> elasticsearch profile: ${profile}"
-            /usr/local/etc/rc.d/elasticsearch $1 ${profile}
+            %%PREFIX%%/etc/rc.d/elasticsearch $1 ${profile}
             retcode="$?"
             if [ "0${retcode}" -ne 0 ]; then
                 failed="${profile} (${retcode}) ${failed:-}"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802221413.w1MEDUdt024499>