From owner-svn-ports-all@freebsd.org Thu Feb 22 14:14:18 2018 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0EE4F07127; Thu, 22 Feb 2018 14:14:17 +0000 (UTC) (envelope-from feld@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A30D38481F; Thu, 22 Feb 2018 14:14:17 +0000 (UTC) (envelope-from feld@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E06FB08; Thu, 22 Feb 2018 14:14:17 +0000 (UTC) (envelope-from feld@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1MEEH3g024729; Thu, 22 Feb 2018 14:14:17 GMT (envelope-from feld@FreeBSD.org) Received: (from feld@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1MEEHuX024727; Thu, 22 Feb 2018 14:14:17 GMT (envelope-from feld@FreeBSD.org) Message-Id: <201802221414.w1MEEHuX024727@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: feld set sender to feld@FreeBSD.org using -f From: Mark Felder Date: Thu, 22 Feb 2018 14:14:17 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-branches@freebsd.org Subject: svn commit: r462591 - in branches/2018Q1/textproc/elasticsearch5: . files X-SVN-Group: ports-branches X-SVN-Commit-Author: feld X-SVN-Commit-Paths: in branches/2018Q1/textproc/elasticsearch5: . files X-SVN-Commit-Revision: 462591 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2018 14:14:18 -0000 Author: feld Date: Thu Feb 22 14:14:17 2018 New Revision: 462591 URL: https://svnweb.freebsd.org/changeset/ports/462591 Log: MFH: r462590 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 Deleted: branches/2018Q1/textproc/elasticsearch5/files/patch-bin_elasticsearch.in.sh Modified: branches/2018Q1/textproc/elasticsearch5/Makefile branches/2018Q1/textproc/elasticsearch5/files/elasticsearch.in Directory Properties: branches/2018Q1/ (props changed) Modified: branches/2018Q1/textproc/elasticsearch5/Makefile ============================================================================== --- branches/2018Q1/textproc/elasticsearch5/Makefile Thu Feb 22 14:13:30 2018 (r462590) +++ branches/2018Q1/textproc/elasticsearch5/Makefile Thu Feb 22 14:14:17 2018 (r462591) @@ -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: branches/2018Q1/textproc/elasticsearch5/files/elasticsearch.in ============================================================================== --- branches/2018Q1/textproc/elasticsearch5/files/elasticsearch.in Thu Feb 22 14:13:30 2018 (r462590) +++ branches/2018Q1/textproc/elasticsearch5/files/elasticsearch.in Thu Feb 22 14:14:17 2018 (r462591) @@ -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:-}"